]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-109413: Fix some trivial mypy nitpicks in libregrtest (#109454)
authorAlex Waygood <Alex.Waygood@Gmail.com>
Fri, 15 Sep 2023 17:01:28 +0000 (18:01 +0100)
committerGitHub <noreply@github.com>
Fri, 15 Sep 2023 17:01:28 +0000 (17:01 +0000)
Lib/test/libregrtest/logger.py
Lib/test/libregrtest/results.py
Lib/test/libregrtest/single.py
Lib/test/libregrtest/worker.py

index c397b21be84385c2fb1bd82fc065dffbd0b75b26..2f0c4bf1c84b5cd186b753236130123c4bb6c184 100644 (file)
@@ -28,13 +28,13 @@ class Logger:
             line = f"load avg: {load_avg:.2f} {line}"
 
         # add the timestamp prefix:  "0:01:05 "
-        test_time = time.perf_counter() - self.start_time
+        log_time = time.perf_counter() - self.start_time
 
-        mins, secs = divmod(int(test_time), 60)
+        mins, secs = divmod(int(log_time), 60)
         hours, mins = divmod(mins, 60)
-        test_time = "%d:%02d:%02d" % (hours, mins, secs)
+        formatted_log_time = "%d:%02d:%02d" % (hours, mins, secs)
 
-        line = f"{test_time} {line}"
+        line = f"{formatted_log_time} {line}"
         if empty:
             line = line[:-1]
 
index f16b3373fd2afbda82bcc562b08e0cf3a547a773..6e7d65880f734764f5c95ad349c429489f732151 100644 (file)
@@ -231,8 +231,7 @@ class TestResults:
             report.append(f'failures={stats.failures:,}')
         if stats.skipped:
             report.append(f'skipped={stats.skipped:,}')
-        report = ' '.join(report)
-        print(f"Total tests: {report}")
+        print(f"Total tests: {' '.join(report)}")
 
         # Total test files
         all_tests = [self.good, self.bad, self.rerun,
@@ -256,5 +255,4 @@ class TestResults:
         ):
             if tests:
                 report.append(f'{name}={len(tests)}')
-        report = ' '.join(report)
-        print(f"Total test files: {report}")
+        print(f"Total test files: {' '.join(report)}")
index bc6021acb34aadb7ac86238cd12ffd3fd362e3c0..0304f858edf42cc88ca3e08037c582e4182028c1 100644 (file)
@@ -136,14 +136,14 @@ def _runtest_env_changed_exc(result: TestResult, runtests: RunTests,
         with saved_test_environment(test_name,
                                     runtests.verbose, quiet, pgo=pgo):
             _load_run_test(result, runtests)
-    except support.ResourceDenied as msg:
+    except support.ResourceDenied as exc:
         if not quiet and not pgo:
-            print(f"{test_name} skipped -- {msg}", flush=True)
+            print(f"{test_name} skipped -- {exc}", flush=True)
         result.state = State.RESOURCE_DENIED
         return
-    except unittest.SkipTest as msg:
+    except unittest.SkipTest as exc:
         if not quiet and not pgo:
-            print(f"{test_name} skipped -- {msg}", flush=True)
+            print(f"{test_name} skipped -- {exc}", flush=True)
         result.state = State.SKIPPED
         return
     except support.TestFailedWithDetails as exc:
index b93670c1c28e8efec5ab6d8efc16769e6615a995..610e0a8437839d97ff1a52a4d8b01af733ea73bc 100644 (file)
@@ -25,7 +25,7 @@ def create_worker_process(runtests: RunTests, output_fd: int,
     if python_cmd is not None:
         executable = python_cmd
     else:
-        executable = [sys.executable]
+        executable = (sys.executable,)
     cmd = [*executable, *support.args_from_interpreter_flags(),
            '-u',    # Unbuffered stdout and stderr
            '-m', 'test.libregrtest.worker',