diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2017-06-26 16:33:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-26 16:33:19 (GMT) |
commit | 63f54c68936d648c70ca411661e4208329edcf26 (patch) | |
tree | 39acfeec7ce7e2c2f9fb72977ed6cf53f97923b4 /Lib/test/libregrtest/main.py | |
parent | f5c58c781aa0bb296885baf62f4f39100f2cd93d (diff) | |
download | cpython-63f54c68936d648c70ca411661e4208329edcf26.zip cpython-63f54c68936d648c70ca411661e4208329edcf26.tar.gz cpython-63f54c68936d648c70ca411661e4208329edcf26.tar.bz2 |
bpo-30764: regrtest: add --fail-env-changed option (#2402)
* bpo-30764: regrtest: change exit code on failure
* Exit code 2 if failed tests ("bad")
* Exit code 3 if interrupted
* bpo-30764: regrtest: add --fail-env-changed option
If the option is set, mark a test as failed if it alters the
environment, for example if it creates a file without removing it.
Diffstat (limited to 'Lib/test/libregrtest/main.py')
-rw-r--r-- | Lib/test/libregrtest/main.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py index 1a77655..571eb61 100644 --- a/Lib/test/libregrtest/main.py +++ b/Lib/test/libregrtest/main.py @@ -478,6 +478,8 @@ class Regrtest: result = "FAILURE" elif self.interrupted: result = "INTERRUPTED" + elif self.environment_changed and self.ns.fail_env_changed: + result = "ENV CHANGED" else: result = "SUCCESS" print("Tests result: %s" % result) @@ -538,7 +540,13 @@ class Regrtest: self.rerun_failed_tests() self.finalize() - sys.exit(len(self.bad) > 0 or self.interrupted) + if self.bad: + sys.exit(2) + if self.interrupted: + sys.exit(130) + if self.ns.fail_env_changed and self.environment_changed: + sys.exit(3) + sys.exit(0) def removepy(names): |