You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
general: -c file - load configuration from file instead of trying to locate one of the implicit configuration files.
Both the file_or_dir and -c options, when supplied can effectively change the directory tests get loaded from. ptw should also try to locate pytest.ini file from there, which it doesnt as the args list is not passed while locating ini path. Maybe we should do that?
One problem is that some plugins (like pytest-cov ) are a bit odd (or, maybe they have some reason) and don't respect the --collect-only flag. So, if we do add all args, it might not be as much a dry-run as we would like it to be and have side-effects (like, pytest-cov generates coverage of tests collected ).
On other hand, it might not be too much of side-effect, as we are going to run the tests anyway in the next step. But we should still mention this in docs, lest someone wants to disable this.
Soln 2: Parse its arg list and only pass in this two options
Most desirable result. But parsing and trying to guess the important parameters makes ptw less robust and prone to pytest changes, not to mention the code repetition from pytest
The text was updated successfully, but these errors were encountered:
Oh, interesting. You're right, this isn't what you'd expect.
I like your 1st solution. It's an easy change and will ensure the collection step works identically to the actual pytest call. If a plugin doesn't respect that flag, it should probably be reported as an issue.
Just published v4.0, which includes these. Feel free to open another issue if there's still problems with config collection! Thanks for the issue, @bendtherules!
From pytest docs:
Both the
file_or_dir
and-c
options, when supplied can effectively change the directory tests get loaded from.ptw
should also try to locatepytest.ini
file from there, which it doesnt as the args list is not passed while locating ini path. Maybe we should do that?Soln 1: Pass whole arg list, alongwith
--collect-only
One problem is that some plugins (like pytest-cov ) are a bit odd (or, maybe they have some reason) and don't respect the
--collect-only
flag. So, if we do add all args, it might not be as much a dry-run as we would like it to be and have side-effects (like, pytest-cov generates coverage of tests collected ).On other hand, it might not be too much of side-effect, as we are going to run the tests anyway in the next step. But we should still mention this in docs, lest someone wants to disable this.
Soln 2: Parse its arg list and only pass in this two options
Most desirable result. But parsing and trying to guess the important parameters makes
ptw
less robust and prone topytest
changes, not to mention the code repetition from pytestThe text was updated successfully, but these errors were encountered: