-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
show deselected info after collected info and before test execution #1527
Comments
A plugin is possible I guess, but I wonder if it makes sense to change this behavior in pytest itself:
|
sounds like a good idea |
ok, for me this would be super. |
if we just print the number of selected ones we also avoid the bug wrt deselection reasons |
@RonnyPfannschmidt hmm which bug do you mean? |
I see, thanks! |
+1. A list of deselected tests would be useful. For example, when I see
it will be useful for me to be able to quickly find out which 11 tests were deselected. |
I don't think it's a good idea to print such a list by default. If I use |
@The-Compiler Agree, listing hundreds/thousands of tests by default won't be a good idea :) How about listing them when an additional flag, such as |
I agree with @The-Compiler, if this functionality is implemented it should definitely be opt-in. 😁 |
The following patch adds the deselection count to the 'collected' line, but does not yet remove the deselection summary ( WDYT should we remove this summary line if the deselection count is part of the 'collected' line? diff --git a/_pytest/terminal.py b/_pytest/terminal.py
index 51d21cb..e5c5d9d 100644
--- a/_pytest/terminal.py
+++ b/_pytest/terminal.py
@@ -356,6 +356,8 @@ class TerminalReporter(object):
errors = len(self.stats.get('error', []))
skipped = len(self.stats.get('skipped', []))
+ deselected = len(self.stats.get('deselected', []))
+
if final:
line = "collected "
else:
@@ -365,6 +367,8 @@ class TerminalReporter(object):
line += " / %d errors" % errors
if skipped:
line += " / %d skipped" % skipped
+ if deselected:
+ line += " / %d deselected" % deselected
if self.isatty:
self.rewrite(line, bold=True, erase=True)
if final:
@@ -372,6 +376,7 @@ class TerminalReporter(object):
else:
self.write_line(line)
+ @pytest.hookimpl(trylast=True)
def pytest_collection_modifyitems(self):
self.report_collect(True) |
In my workflow, may be useful get the informations about deselected tests after the collected info an before the beginning of tests executed, because (especially if the test execution takes a long time), I would check if I have properly selected the test to run.
For instance, would be nice something like this:
Currently this info is shown after the test execution.
I was wondering if there is an easy way to get this also before the test execution, maybe writing a plugin?
Thanks
The text was updated successfully, but these errors were encountered: