[TIP] pytest, setup.py and custom options

Daniel Farina daniel at heroku.com
Tue Nov 26 22:35:48 PST 2013

On Tue, Nov 26, 2013 at 9:12 PM, Sean Fisk <sean at seanfisk.com> wrote:
> Hi Daniel,
> The excellent pytest documentation has a section on Setuptools integration.
> In that example, you would want to write instead:
> # ...
> self.test_args = ['--flakes']
> # ...

I don't want a static list of these options: I want the user to be
able to modify them.  I want to have the defaults to be sane (I may
add a few common options) but allow advanced and/or slow use cases
(like coverage generation) to be added by the user.

In retrospect, I think I can do this by munging sys.argv before
setup() is called, but I am wondering if that is among the better
ways.  It seems rather heavyhanded for setuptools to insist to be
informed a-priori of every single valid option, so I imagine there may
be another way.

More information about the testing-in-python mailing list