diff options
| author | Stefano Rivera <stefano@rivera.za.net> | 2023-04-27 01:28:46 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-27 01:28:46 (GMT) |
| commit | 76632b836cf81a95301f4eb1fa43682e8d9ffa67 (patch) | |
| tree | e34dfe04b641f614b06423ff7abd853d765e452d /Lib/unittest/runner.py | |
| parent | dc3f97549a8fe4f7fea8d0326e394760b51caa6e (diff) | |
| download | cpython-76632b836cf81a95301f4eb1fa43682e8d9ffa67.zip cpython-76632b836cf81a95301f4eb1fa43682e8d9ffa67.tar.gz cpython-76632b836cf81a95301f4eb1fa43682e8d9ffa67.tar.bz2 | |
gh-62432: unittest runner: Exit code 5 if no tests were run (#102051)
As discussed in https://discuss.python.org/t/unittest-fail-if-zero-tests-were-discovered/21498/7
It is common for test runner misconfiguration to fail to find any tests,
This should be an error.
Fixes: #62432
Diffstat (limited to 'Lib/unittest/runner.py')
| -rw-r--r-- | Lib/unittest/runner.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/unittest/runner.py b/Lib/unittest/runner.py index a51c5c5..e3c020e 100644 --- a/Lib/unittest/runner.py +++ b/Lib/unittest/runner.py @@ -274,6 +274,8 @@ class TextTestRunner(object): infos.append("failures=%d" % failed) if errored: infos.append("errors=%d" % errored) + elif run == 0: + self.stream.write("NO TESTS RAN") else: self.stream.write("OK") if skipped: |
