diff options
| author | Victor Stinner <victor.stinner@gmail.com> | 2017-06-27 16:04:15 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-06-27 16:04:15 +0200 |
| commit | 35d2ca2b94a6ff29e763ddb7727166f0592edfa2 (patch) | |
| tree | 512fa70566c41f8d8f9d78b026d360a676cf32a7 /Lib/test/libregrtest/main.py | |
| parent | 39e501a2913eff047f7a644e2b20eb4278f97d50 (diff) | |
| download | cpython-git-35d2ca2b94a6ff29e763ddb7727166f0592edfa2.tar.gz | |
[3.6] bpo-30523, bpo-30764, bpo-30776: Sync regrtest from master (#2441)
* bpo-30523: regrtest --list-cases --match (#2401)
* regrtest --list-cases now supports --match and --match-file options.
Example: ./python -m test --list-cases -m FileTests test_os
* --list-cases now also sets support.verbose to False to prevent
messages to stdout when loading test modules.
* Add support._match_test() private function.
(cherry picked from commit ace56d583664f855d89d1219ece7c21c2fddcf30)
* 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.
(cherry picked from commit 63f54c68936d648c70ca411661e4208329edcf26)
* bpo-30776: reduce regrtest -R false positives (#2422)
* Change the regrtest --huntrleaks checker to decide if a test file
leaks or not. Require that each run leaks at least 1 reference.
* Warmup runs are now completely ignored: ignored in the checker test
and not used anymore to compute the sum.
* Add an unit test for a reference leak.
Example of reference differences previously considered a failure
(leak) and now considered as success (success, no leak):
[3, 0, 0]
[0, 1, 0]
[8, -8, 1]
(cherry picked from commit 48b5c422ffb03affb00c184b9a99e5537be92732)
Diffstat (limited to 'Lib/test/libregrtest/main.py')
| -rw-r--r-- | Lib/test/libregrtest/main.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py index 527de17779..571eb61125 100644 --- a/Lib/test/libregrtest/main.py +++ b/Lib/test/libregrtest/main.py @@ -256,9 +256,13 @@ class Regrtest: if isinstance(test, unittest.TestSuite): self._list_cases(test) elif isinstance(test, unittest.TestCase): - print(test.id()) + if support._match_test(test): + print(test.id()) def list_cases(self): + support.verbose = False + support.match_tests = self.ns.match_tests + for test in self.selected: abstest = get_abs_module(self.ns, test) try: @@ -474,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) @@ -534,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): |
