Skip to content

Commit

Permalink
Fix some unused function args in run.py and its test. (#17530)
Browse files Browse the repository at this point in the history
Also fix a function arg default that was mutable to be immutable.
  • Loading branch information
benjyw authored Nov 17, 2022
1 parent 6c2be26 commit 06d1691
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
4 changes: 1 addition & 3 deletions src/python/pants/core/goals/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from itertools import filterfalse, tee
from typing import Callable, Iterable, Mapping, NamedTuple, Optional, Tuple, TypeVar

from pants.base.build_root import BuildRoot
from pants.core.subsystems.debug_adapter import DebugAdapterSubsystem
from pants.core.util_rules.environments import _warn_on_non_local_environments
from pants.engine.env_vars import CompleteEnvironmentVars
Expand Down Expand Up @@ -225,8 +224,7 @@ async def run(
run_subsystem: RunSubsystem,
debug_adapter: DebugAdapterSubsystem,
global_options: GlobalOptions,
workspace: Workspace,
build_root: BuildRoot,
workspace: Workspace, # Needed to enable sideeffecting.
complete_env: CompleteEnvironmentVars,
) -> Run:
field_set, target = await _find_what_to_run("the `run` goal")
Expand Down
12 changes: 4 additions & 8 deletions src/python/pants/core/goals/run_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import pytest

from pants.base.build_root import BuildRoot
from pants.core.goals.run import (
Run,
RunDebugAdapterRequest,
Expand Down Expand Up @@ -47,6 +46,7 @@
mock_console,
run_rule_with_mocks,
)
from pants.util.frozendict import FrozenDict


@pytest.fixture
Expand Down Expand Up @@ -92,8 +92,9 @@ def single_target_run(
rule_runner: RuleRunner,
*,
program_text: bytes,
targets_to_field_sets: Mapping[Target, Iterable[FieldSet]] = {A_TARGET: [A_FIELD_SET]},
run_field_set_types=[TestRunFieldSet],
targets_to_field_sets: Mapping[Target, Iterable[FieldSet]] = FrozenDict(
{A_TARGET: (A_FIELD_SET,)}
),
) -> Run:
workspace = Workspace(rule_runner.scheduler, _enforce_effects=False)

Expand All @@ -113,7 +114,6 @@ def single_target_run(
keep_sandboxes=KeepSandboxes.never,
),
workspace,
BuildRoot(),
rule_runner.environment,
],
mock_gets=[
Expand Down Expand Up @@ -218,7 +218,6 @@ def test_filters_secondary_owners_single_target(rule_runner: RuleRunner) -> None
rule_runner,
program_text=program_text,
targets_to_field_sets={target: [fs1, fs2]},
run_field_set_types=[TestRunFieldSet, TestRunSecondaryFieldSet],
)
assert res.exit_code == 0

Expand All @@ -233,7 +232,6 @@ def test_filters_secondary_owners_multi_target(rule_runner: RuleRunner) -> None:
rule_runner,
program_text=program_text,
targets_to_field_sets={t1: [fs1], t2: [fs2]},
run_field_set_types=[TestRunFieldSet, TestRunSecondaryFieldSet],
)
assert res.exit_code == 0

Expand All @@ -246,7 +244,6 @@ def test_only_secondary_owner_ok_single_target(rule_runner: RuleRunner) -> None:
rule_runner,
program_text=program_text,
targets_to_field_sets={target: [field_set]},
run_field_set_types=[TestRunFieldSet, TestRunSecondaryFieldSet],
)
assert res.exit_code == 0

Expand All @@ -262,7 +259,6 @@ def test_only_secondary_owner_error_multi_target(rule_runner: RuleRunner) -> Non
rule_runner,
program_text=program_text,
targets_to_field_sets={t1: [fs1], t2: [fs2]},
run_field_set_types=[TestRunSecondaryFieldSet],
)


Expand Down

0 comments on commit 06d1691

Please sign in to comment.