-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-109413: Fix some trivial mypy nitpicks in libregrtest #109454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
Comment on lines
-139
to
+146
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This passage was causing mypy to get very agitated:
Mypy was getting confused because the |
||
result.state = State.SKIPPED | ||
return | ||
except support.TestFailedWithDetails as exc: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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,) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mypy complained about this line because on line 26, the |
||
cmd = [*executable, *support.args_from_interpreter_flags(), | ||
'-u', # Unbuffered stdout and stderr | ||
'-m', 'test.libregrtest.worker', | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's the same issue here:
report
is a list earlier on in the function, but at this location, it's being assigned to astr
. We could use a new variable name, or just do what I suggest here (make it an "anonymous variable")