pyznap
pyznap copied to clipboard
Integrate tests with setuptools
Hi,
I noticed that some python programs have the ability to select which tests to run. Could you elaborate if this is possible with your program?
The test command I'm running is: python3.6 setup.py test
and something that is of use as example: python3.6 setup.py test --pytest-args "-k 'not test_integration'" python3.6 setup.py test -a "--ignore=tests/test_reader.py"
This has the ability to disable tests. Do you know if this is possible?
I noticed that it fails with usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: setup.py --help [cmd1 cmd2 ...] or: setup.py --help-commands or: setup.py cmd --help
Could you take a look at https://docs.pytest.org/en/latest/goodpractices.html for integration with setup tools? Thanks!
There are slow and non-slow tests, you can run them directly with pytest using either
pytest -v tests/
to run only the non-slow tests or
pytest -v -m 'slow' tests/
to run the slow ones. I've been following that guide mostly in the setup of my tests, but I don't use pytest with setuptools, so there are no options on what tests to run with setuptools. But just use pytest directly.
Hmmm I see, I ask because FreeBSD's python infrastructure is heavily integrated with setuptools . So if we ever want tests to work on FreeBSD I need to be able to select which ones to run from the setup tools command I showed above ... :(
Feel free to do a pull request :). I might change this at some point, but at the moment I have other priorities.
Let me see what I can cook up ;)