[TIP] pytest, setup.py and custom options

Daniel Farina daniel at heroku.com
Tue Nov 26 17:57:00 PST 2013


I would like to support "python setup.py test" to allow people to more
easily get started with a project I work on.  I use pytest, which
supports a large collection of options, and my scrying on the Internet
fails to produce a way to support simply passing these through to
pytest to interpret.

For example, let's say I normally I run something like this:

    py.test --flakes

This works fine.

But suppose I try to enable precisely this same thing via "python
setup.py test --flakes", then I receive:

"error: option --flakes not recognized"

It's not entirely clear to me when these option checks occur and how I
could accept all options and delegate their handling (and error
messages) to pytest.

Thanks in advance for any advice one can offer.

More information about the testing-in-python mailing list