Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot run tests #233

Open
MarDiehl opened this issue May 9, 2024 · 5 comments
Open

cannot run tests #233

MarDiehl opened this issue May 9, 2024 · 5 comments
Assignees

Comments

@MarDiehl
Copy link

MarDiehl commented May 9, 2024

I'm providing yamlpath as an Arch linux package. It works fine, but it is recommended to run tests when building the package.

Operating System

  1. Name/Distribution: Arch Linux
  2. Version: rolling/current

Version of Python and packages in use at the time of the issue.

  1. Distribution:
  2. Python Version: 3.12.3
  3. Version of yamlpath installed: 3.8.2
  4. Version of ruamel.yaml installed: 0.18.6

Minimum sample of YAML (or compatible) data necessary to trigger the issue

n/a

Complete steps to reproduce the issue when triggered via:

run pytest in the test folder

Expected Outcome

all tests should run

Actual Outcome

due to lack of conftest.py, errors like ImportError: cannot import name 'info_warn_logger' from 'tests.conftest'

Screenshot(s), if Available

n/a

@wwkimball
Copy link
Owner

Please refer to the run-tests.sh shell script in the root directory of this project or the GitHub Actions which also successfully run a gamut of tests against this project. While I cannot personally vouch for Arch Linux success, I do run these tests myself against several operating systems (Windows, OSX, and Linux [Ubuntu and Red Hat]) without issue.

Please also note that I have not yet certified this project to run using Python 12. The supported range is listed for this project in badging here at GitHub as well as the published metadata for yamlpath.

While yamlpath might run with Python 12, it will definitely NOT run with ruamel.yaml 0.18. Please follow the published metadata for support libraries, which restricts ruamel.yaml to compatible versions. When I exclude versions of ruamel.yaml, it is because incompatible versions cause errors in yamlpath.

@MarDiehl
Copy link
Author

MarDiehl commented May 9, 2024

thanks for the detailed response.

Unfortunately, the release tarball (https://github.com/wwkimball/yamlpath/releases/download/v3.8.2/yamlpath-3.8.2.tar.gz) does not contain the run-tests.sh.

@wwkimball
Copy link
Owner

The release tarball should not contain development resources. My recommendation isn't to run the script but rather to base your own build's test phase on its content or that of the relevant GitHub Actions.

The issue you've presented is that your test runner code isn't working. I provided examples of test runner code that does work. Update your test runner code to match and yours should also work.

@MarDiehl
Copy link
Author

MarDiehl commented May 9, 2024

ok, then I would suggest to remove the test resources completely. For me it was unexpected to find a tests folder but the tests cannot be executed.

@wwkimball
Copy link
Owner

That is an interesting proposal. I may do so to reduce the package size. The tests are included only because the original "authoritative" template I used to package this project for release mandated that the tests be included. I will research this to determine whether Python release packages are actually expected to include tests given that release packages necessarily do not include the required test tools like pytest, et al.

That said, it is incorrect to state that the tests "cannot" be run. Rather, you aren't setting up your test environment to run them. Release packages cannot include build or test tools, so if you want to run tests against a release package, it falls on you to install and configure the additional tools. I have provided instructions for how to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants