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

Tests directory name gets autocompleted #48

Closed
jdelafon opened this issue Mar 17, 2016 · 4 comments · Fixed by michaeljoseph/mould#12
Closed

Tests directory name gets autocompleted #48

jdelafon opened this issue Mar 17, 2016 · 4 comments · Fixed by michaeljoseph/mould#12

Comments

@jdelafon
Copy link

My project has a directory tests containing the unit tests I want to run with pytests. It also has a directory tests_functional, which I don't want to run continuously.

py.test tests/

will run only my unit tests, while

ptw tests/

will also run everything in tests_functional, even so:

ptw --ignore ./tests_functional ./tests

I don't see any way to run only what is in the tests folder. Moreover, I would expect a pytest extension to gather tests the same way pytest (and pytest-xdist) does.

@joeyespo
Copy link
Owner

Hi, @muraveill!

At a glance, this looks like a bug. I'll take a deeper look at this later to see what's going on.

For now, try passing those args directly to py.test:

$ ptw -- --ignore ./tests_functional

(Note the extra --. Also the ./tests argument shouldn't be necessary.)

@joeyespo
Copy link
Owner

joeyespo commented Apr 2, 2016

Ok, so it turns out this worked as implemented. But since the CLI is misleading about what --ignore does, and that running ptw --ignore tests_functional -- --ignore tests_functional is way too verbose, I'm looking into improving this.

In the next release, you should be able to do what you did an expect it to ignore tests_functional in both the pytest-watch observer and in py.test.

Thanks for pointing out this awkward design!

@joeyespo
Copy link
Owner

joeyespo commented Apr 6, 2016

Just published v4.0, which forwards all --ignore arguments to pytest (6f3eb56).

After running pip install --upgrade pytest-watch, you should be able to run

$ ptw --ignore ./tests_functional

and have it work as expected (ptw doesn't watch that directory and pytest doesn't collect tests from it either). Thanks again!

@jdelafon
Copy link
Author

It works perfectly now, thanks!

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

Successfully merging a pull request may close this issue.

2 participants