Skip to content

Add support for exclusive tests #585

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

Closed
pytestbot opened this issue Sep 8, 2014 · 6 comments
Closed

Add support for exclusive tests #585

pytestbot opened this issue Sep 8, 2014 · 6 comments
Labels
type: enhancement new feature or API change, should be merged into features branch

Comments

@pytestbot
Copy link
Contributor

Originally reported by: Barry Fitzgerald (BitBucket: pablojim, GitHub: pablojim)


Allowing exclusive tests can give a quicker workflow when debugging a single failing test.

This would work like this - if I appended "only_" to any of my test functions only these tests in the current module would be run.

Would this functionality be accepted as a pull request?

See: http://tobyho.com/2012/09/12/better-tdd-workflow-via-exclusive-tests-in-jasmine-and-mocha/ for example of this in other test frameworks.


@pytestbot
Copy link
Contributor Author

Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42):


Not into core i'd think. Did you try out:

https://pypi.python.org/pypi/pytest-cache

and the dynamic "--lf" "--ff" options?

@pytestbot
Copy link
Contributor Author

Original comment by Barry Fitzgerald (BitBucket: pablojim, GitHub: pablojim):


That's disappointing. Two questions:

Any particular reasons why this wouldn't be accepted into core?
Could this functionality be added with a plugin?

Thanks.

@pytestbot
Copy link
Contributor Author

Original comment by Floris Bruynooghe (BitBucket: flub, GitHub: flub):


Only had a quick look so far but isn't this also achieved by using e.g. @pytest.mark.exclusive on tests and then using py.test -m exclusive?

@pytestbot
Copy link
Contributor Author

Original comment by Barry Fitzgerald (BitBucket: pablojim, GitHub: pablojim):


Yes that is similar. This is just a convenience. See my link for some discussion.

@pytestbot
Copy link
Contributor Author

Original comment by BitBucket: sscarwell, GitHub: sscarwell:


If a change had to be made, it might be better to add regular expression support (e.g. passing the -k argument to re.search).
I think this would fix your problem, and would be more general purpose.

@pytestbot
Copy link
Contributor Author

Original comment by BitBucket: sscarwell, GitHub: sscarwell:


In your conftest.py, you could define pytest_collection_modifyitems(items) to apply any <debugMarker>, for all functions ending with _only.
Then you can run py.test -m <debugMarker>

@pytestbot pytestbot added the type: enhancement new feature or API change, should be merged into features branch label Jun 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement new feature or API change, should be merged into features branch
Projects
None yet
Development

No branches or pull requests

1 participant