wwkimball / yamlpath

YAML/JSON/EYAML/Compatible get/set/merge/validate/scan/convert/diff processors using powerful, intuitive, command-line friendly syntax.
https://github.com/wwkimball/yamlpath/wiki
ISC License
118 stars 21 forks source link

cannot run tests #233

Open MarDiehl opened 4 months ago

MarDiehl commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

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.