Skip to content

Commit 92ed7e4

Browse files
authored
gh-109413: Fix some trivial mypy nitpicks in libregrtest (#109454)
1 parent 8ea4ad4 commit 92ed7e4

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

Lib/test/libregrtest/logger.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ def log(self, line: str = '') -> None:
2828
line = f"load avg: {load_avg:.2f} {line}"
2929

3030
# add the timestamp prefix: "0:01:05 "
31-
test_time = time.perf_counter() - self.start_time
31+
log_time = time.perf_counter() - self.start_time
3232

33-
mins, secs = divmod(int(test_time), 60)
33+
mins, secs = divmod(int(log_time), 60)
3434
hours, mins = divmod(mins, 60)
35-
test_time = "%d:%02d:%02d" % (hours, mins, secs)
35+
formatted_log_time = "%d:%02d:%02d" % (hours, mins, secs)
3636

37-
line = f"{test_time} {line}"
37+
line = f"{formatted_log_time} {line}"
3838
if empty:
3939
line = line[:-1]
4040

Lib/test/libregrtest/results.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,7 @@ def display_summary(self, first_runtests: RunTests, filtered: bool):
231231
report.append(f'failures={stats.failures:,}')
232232
if stats.skipped:
233233
report.append(f'skipped={stats.skipped:,}')
234-
report = ' '.join(report)
235-
print(f"Total tests: {report}")
234+
print(f"Total tests: {' '.join(report)}")
236235

237236
# Total test files
238237
all_tests = [self.good, self.bad, self.rerun,
@@ -256,5 +255,4 @@ def display_summary(self, first_runtests: RunTests, filtered: bool):
256255
):
257256
if tests:
258257
report.append(f'{name}={len(tests)}')
259-
report = ' '.join(report)
260-
print(f"Total test files: {report}")
258+
print(f"Total test files: {' '.join(report)}")

Lib/test/libregrtest/single.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,14 @@ def _runtest_env_changed_exc(result: TestResult, runtests: RunTests,
136136
with saved_test_environment(test_name,
137137
runtests.verbose, quiet, pgo=pgo):
138138
_load_run_test(result, runtests)
139-
except support.ResourceDenied as msg:
139+
except support.ResourceDenied as exc:
140140
if not quiet and not pgo:
141-
print(f"{test_name} skipped -- {msg}", flush=True)
141+
print(f"{test_name} skipped -- {exc}", flush=True)
142142
result.state = State.RESOURCE_DENIED
143143
return
144-
except unittest.SkipTest as msg:
144+
except unittest.SkipTest as exc:
145145
if not quiet and not pgo:
146-
print(f"{test_name} skipped -- {msg}", flush=True)
146+
print(f"{test_name} skipped -- {exc}", flush=True)
147147
result.state = State.SKIPPED
148148
return
149149
except support.TestFailedWithDetails as exc:

Lib/test/libregrtest/worker.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def create_worker_process(runtests: RunTests, output_fd: int,
2525
if python_cmd is not None:
2626
executable = python_cmd
2727
else:
28-
executable = [sys.executable]
28+
executable = (sys.executable,)
2929
cmd = [*executable, *support.args_from_interpreter_flags(),
3030
'-u', # Unbuffered stdout and stderr
3131
'-m', 'test.libregrtest.worker',

0 commit comments

Comments
 (0)