bukzor
bukzor

Reputation: 38462

setuptools: testing my extras

I'd like to support an interface where a new dev just needs to run python setup.py test to run all my tests. I think that's reasonable.

Given that I have several "extras" defined in my package (optional features with their own dependencies), how do I make sure the tests for these run correctly under python setup.py test.

Is this too much to hope for?

For example, I tried adding .[extra-feature-1] to my tests_require list, but that was obviously wishful thinking.

Upvotes: 3

Views: 655

Answers (1)

Tristan
Tristan

Reputation: 11

To make sure extras are installed when running tests you use the --extras argument when running setup.py.

you can add default options for setup.py using the setup.cfg file.

e.g. in setup.cfg add:

[test]
extras=1

or if you use pytest:

[aliases]
test=pytest
[pytest]
extras=1

with this, running python setup.py test will automatically add --extras to the command

Upvotes: 1

Related Questions