[Python-checkins] cpython: Issue #25220: truncate some long lines in libregrtest/*.py
victor.stinner
python-checkins at python.org
Tue Sep 29 23:56:30 CEST 2015
https://hg.python.org/cpython/rev/e6b48bfd6d8e
changeset: 98419:e6b48bfd6d8e
user: Victor Stinner <victor.stinner at gmail.com>
date: Tue Sep 29 23:43:33 2015 +0200
summary:
Issue #25220: truncate some long lines in libregrtest/*.py
files:
Lib/test/libregrtest/main.py | 23 ++++++++++++-----
Lib/test/libregrtest/runtest_mp.py | 12 ++++++---
2 files changed, 24 insertions(+), 11 deletions(-)
diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py
--- a/Lib/test/libregrtest/main.py
+++ b/Lib/test/libregrtest/main.py
@@ -63,7 +63,8 @@
# the packages to prevent later imports to fail when the CWD is different.
for module in sys.modules.values():
if hasattr(module, '__path__'):
- module.__path__ = [os.path.abspath(path) for path in module.__path__]
+ module.__path__ = [os.path.abspath(path)
+ for path in module.__path__]
if hasattr(module, '__file__'):
module.__file__ = os.path.abspath(module.__file__)
@@ -159,8 +160,8 @@
if self.ns.quiet:
return
fmt = "[{1:{0}}{2}/{3}] {4}" if self.bad else "[{1:{0}}{2}] {4}"
- print(fmt.format(
- self.test_count_width, test_index, self.test_count, len(self.bad), test))
+ print(fmt.format(self.test_count_width, test_index,
+ self.test_count, len(self.bad), test))
sys.stdout.flush()
def setup_regrtest(self):
@@ -252,7 +253,10 @@
self.ns.args = []
# For a partial run, we do not need to clutter the output.
- if self.ns.verbose or self.ns.header or not (self.ns.quiet or self.ns.single or self.tests or self.ns.args):
+ if (self.ns.verbose
+ or self.ns.header
+ or not (self.ns.quiet or self.ns.single
+ or self.tests or self.ns.args)):
# Print basic platform information
print("==", platform.python_implementation(), *sys.version.split())
print("== ", platform.platform(aliased=True),
@@ -283,7 +287,8 @@
try:
del self.selected[:self.selected.index(self.ns.start)]
except ValueError:
- print("Couldn't find starting test (%s), using all tests" % self.ns.start)
+ print("Couldn't find starting test (%s), using all tests"
+ % self.ns.start)
if self.ns.randomize:
if self.ns.random_seed is None:
@@ -297,12 +302,16 @@
# print a newline after ^C
print()
print("Test suite interrupted by signal SIGINT.")
- omitted = set(self.selected) - set(self.good) - set(self.bad) - set(self.skipped)
+ executed = set(self.good) | set(self.bad) | set(self.skipped)
+ omitted = set(self.selected) - executed
print(count(len(omitted), "test"), "omitted:")
printlist(omitted)
if self.good and not self.ns.quiet:
- if not self.bad and not self.skipped and not self.interrupted and len(self.good) > 1:
+ if (not self.bad
+ and not self.skipped
+ and not self.interrupted
+ and len(self.good) > 1):
print("All", end=' ')
print(count(len(self.good), "test"), "OK.")
diff --git a/Lib/test/libregrtest/runtest_mp.py b/Lib/test/libregrtest/runtest_mp.py
--- a/Lib/test/libregrtest/runtest_mp.py
+++ b/Lib/test/libregrtest/runtest_mp.py
@@ -103,20 +103,23 @@
except StopIteration:
self.output.put((None, None, None, None))
return
- retcode, stdout, stderr = run_tests_in_subprocess(test, self.ns)
+ retcode, stdout, stderr = run_tests_in_subprocess(test,
+ self.ns)
# Strip last refcount output line if it exists, since it
# comes from the shutdown of the interpreter in the subcommand.
stderr = debug_output_pat.sub("", stderr)
stdout, _, result = stdout.strip().rpartition("\n")
if retcode != 0:
result = (CHILD_ERROR, "Exit code %s" % retcode)
- self.output.put((test, stdout.rstrip(), stderr.rstrip(), result))
+ self.output.put((test, stdout.rstrip(), stderr.rstrip(),
+ result))
return
if not result:
self.output.put((None, None, None, None))
return
result = json.loads(result)
- self.output.put((test, stdout.rstrip(), stderr.rstrip(), result))
+ self.output.put((test, stdout.rstrip(), stderr.rstrip(),
+ result))
except BaseException:
self.output.put((None, None, None, None))
raise
@@ -149,7 +152,8 @@
if result[0] == INTERRUPTED:
raise KeyboardInterrupt
if result[0] == CHILD_ERROR:
- raise Exception("Child error on {}: {}".format(test, result[1]))
+ msg = "Child error on {}: {}".format(test, result[1])
+ raise Exception(msg)
test_index += 1
except KeyboardInterrupt:
regrtest.interrupted = True
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list