Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ini path collected doesnt respect pytest options -c and [file_or_dir] #40

Closed
bendtherules opened this issue Dec 5, 2015 · 3 comments · Fixed by michaeljoseph/mould#12
Labels

Comments

@bendtherules
Copy link
Contributor

From pytest docs:

usage: py.test [options] [file_or_dir] [file_or_dir] [...]

positional arguments:
file_or_dir

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?

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 to pytest changes, not to mention the code repetition from pytest

@joeyespo
Copy link
Owner

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.

Up for tackling this?

@bendtherules
Copy link
Contributor Author

Yes, I'll give a try.

@joeyespo
Copy link
Owner

joeyespo commented Apr 6, 2016

Fixed with ede80ff and 2637366.

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants