-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
This is extended from #1187.
In my case there is some surprising behaviour. If I run the test suite using addopts
from setup.cfg
then the tests are duplicated and detected twice. However if I run it using addopts
from pytest.ini
, then the problem goes away, which is very strange.
After using --debug
, I can see that the arguments are actually duplicated when using setup.cfg
;
args=['-rw', '-vv', '--maxfail=1', '--cov=bottlecap.py', '--showlocals', '--doctest-modules',
'--cov-report=term-missing', '--trace-config', '--debug', 'tests', '-rw', '-vv', '--maxfail=1',
'--cov=bottlecap.py', '--showlocals', '--doctest-modules', '--cov-report=term-missing',
'--trace-config', '--debug', 'tests']
There are also issues with using setup.cfg
, for example passing in testpaths
results in an error;
$ python setup.py test
running pytest
error: error in setup.cfg: command 'PyTest' has no such option 'testpaths'
There is a comment by a maintainer usage of setup.cfg
should be deprecated. All of the problems mentioned above seem to go away if I use pytest.ini
, and there doesn't appear to be any clear advantage of trying to use setup.cfg
for this.
Another option is to make [pytest]
section of setup.cfg
work exactly the same as if it was in pytest.ini
, but I'm not sure how feasible that is. Alternatively, dropping support for that section in setup.cfg
might be another option.
Thoughts @RonnyPfannschmidt / @nicoddemus ?