pyznap icon indicating copy to clipboard operation
pyznap copied to clipboard

Integrate tests with setuptools

Open driesmp opened this issue 5 years ago • 4 comments

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!

driesmp avatar Mar 01 '19 15:03 driesmp

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.

yboetz avatar Mar 01 '19 16:03 yboetz

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 ... :(

driesmp avatar Mar 01 '19 16:03 driesmp

Feel free to do a pull request :). I might change this at some point, but at the moment I have other priorities.

yboetz avatar Mar 01 '19 16:03 yboetz

Let me see what I can cook up ;)

driesmp avatar Mar 01 '19 16:03 driesmp