| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -2012,13 +2012,16 @@ Loading and running tests | |
|
|
||
| .. method:: wasSuccessful() | ||
|
|
||
| Return ``True`` if all tests run so far have passed, otherwise returns | ||
| ``False``. | ||
| Return ``True`` if all tests run so far have passed and at least one test | ||
| was found, otherwise returns ``False``. | ||
|
|
||
| .. versionchanged:: 3.4 | ||
| Returns ``False`` if there were any :attr:`unexpectedSuccesses` | ||
| from tests marked with the :func:`expectedFailure` decorator. | ||
|
|
||
| .. versionchanged:: 3.10b1 | ||
|
Comment thread
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityThis will probably need to be 3.11 now.
Sorry, something went wrong.
All reactions
|
||
| Returns ``False`` if no tests were found. | ||
|
|
||
| .. method:: stop() | ||
|
|
||
| This method can be called to signal that the set of tests being run should | ||
| Expand Down | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -184,8 +184,11 @@ def run(self, test): | |
| if hasattr(result, 'separator2'): | ||
| self.stream.writeln(result.separator2) | ||
| run = result.testsRun | ||
| self.stream.writeln("Ran %d test%s in %.3fs" % | ||
| (run, run != 1 and "s" or "", timeTaken)) | ||
| if run > 0 or len(result.skipped) > 0: | ||
|
Comment thread
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityI'd abstract the run > 0 or len(result.skipped) calculation as a method on TestResult, then you won't have it repeated twice. And you can give it a name indicating what it means.
Sorry, something went wrong.
All reactions
|
||
| self.stream.writeln("Ran %d test%s in %.3fs" % | ||
| (run, run != 1 and "s" or "", timeTaken)) | ||
| else: | ||
| self.stream.writeln("No tests found") | ||
| self.stream.writeln() | ||
|
|
||
| expectedFails = unexpectedSuccesses = skipped = 0 | ||
| Expand Down | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| :func:`unittest.TestResult.wasSuccessful` now returns False if no tests were | ||
| found. |
| Back | FazBrowse Home | New Git URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityThe code checks testsRun + testsSkipped > 0, so it's not exactly "was found" (what if many were found but we haven't started running anything yet?)
nit: I think it's easier to understand if the sentence lists the conditions chronologically, something like: "at least one test has been executed or skipped and no test has failed so far".
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.