addopts behavior with coverage flag #2165
Labels
topic: config
related to config handling, argument parsing and config file
type: enhancement
new feature or API change, should be merged into features branch
(uncertain if this is specific to py.test config, or pytest-cov, apologies if I'm putting it in the wrong place)
It appears that the
addopts
section of config file appends positional arguments to option flags following, making specifying a path of tests to include dependent on the order of the option flags.Note: I use the
--collect-only
flag as an example, in my project I've got others like--duration=10
, etc - I tried to use a simple reproduction approach.pip list
of the virtual environment you are usingGiven a
setup.cfg
section like:And a directory tree structure like:
And test_sample?.py contains this example:
When running
py.test app/one/
Then both test cases are collected, instead of only one.
Output:
It appears that the path specified on the commandline is being passed to
--cov
Workaround
Changing the
setup.cfg
to reverse the options like so:Produces the correct result:
The text was updated successfully, but these errors were encountered: