summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/runner.py
diff options
context:
space:
mode:
authorStefano Rivera <stefano@rivera.za.net>2023-04-27 01:28:46 (GMT)
committerGitHub <noreply@github.com>2023-04-27 01:28:46 (GMT)
commit76632b836cf81a95301f4eb1fa43682e8d9ffa67 (patch)
treee34dfe04b641f614b06423ff7abd853d765e452d /Lib/unittest/runner.py
parentdc3f97549a8fe4f7fea8d0326e394760b51caa6e (diff)
downloadcpython-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.py2
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: