Skip to content

Commit

Permalink
Replace skip placeholders with real SkipOptions in test subsystem…
Browse files Browse the repository at this point in the history
  • Loading branch information
danxmoran authored Oct 28, 2022
1 parent 6951a47 commit 9c6097e
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 29 deletions.
3 changes: 1 addition & 2 deletions src/python/pants/backend/go/goals/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ def opt_out(cls, tgt: Target) -> bool:


class GoTestRequest(TestRequest):
# TODO: Remove the type-ignore after adding a `skip` option to the subsystem.
tool_subsystem = GoTestSubsystem # type: ignore[assignment]
tool_subsystem = GoTestSubsystem
field_set_type = GoTestFieldSet


Expand Down
5 changes: 2 additions & 3 deletions src/python/pants/backend/go/subsystems/gotest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from pants.backend.go.util_rules.coverage import GoCoverMode
from pants.core.util_rules.distdir import DistDir
from pants.option.option_types import ArgsListOption, BoolOption, EnumOption, StrOption
from pants.option.option_types import ArgsListOption, BoolOption, EnumOption, SkipOption, StrOption
from pants.option.subsystem import Subsystem
from pants.util.strutil import softwrap

Expand Down Expand Up @@ -66,8 +66,7 @@ class GoTestSubsystem(Subsystem):
),
)

# TODO: Replace with a proper `SkipOption`.
skip = False
skip = SkipOption("test")

def coverage_output_dir(self, distdir: DistDir, import_path: str) -> PurePath:
import_path_escaped = import_path.replace("/", "_")
Expand Down
5 changes: 2 additions & 3 deletions src/python/pants/backend/helm/subsystems/unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from pants.engine.platform import Platform
from pants.engine.rules import collect_rules, rule
from pants.engine.unions import UnionRule
from pants.option.option_types import BoolOption, EnumOption
from pants.option.option_types import BoolOption, EnumOption, SkipOption


class HelmUnitTestReportFormat(Enum):
Expand Down Expand Up @@ -53,8 +53,7 @@ class HelmUnitTestSubsystem(ExternalHelmPlugin):
help="Output type used for the test report.",
)

# TODO: Replace with a proper `SkipOption`.
skip = False
skip = SkipOption("test")

def generate_exe(self, _: Platform) -> str:
return "./untt"
Expand Down
3 changes: 1 addition & 2 deletions src/python/pants/backend/helm/test/unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ class HelmUnitTestFieldSet(TestFieldSet):


class HelmUnitTestRequest(TestRequest):
# TODO: Remove the type-ignore after adding a `skip` option to the subsystem.
tool_subsystem = HelmUnitTestSubsystem # type: ignore[assignment]
tool_subsystem = HelmUnitTestSubsystem
field_set_type = HelmUnitTestFieldSet


Expand Down
5 changes: 2 additions & 3 deletions src/python/pants/backend/java/subsystems/junit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from pants.jvm.resolve.jvm_tool import JvmToolBase
from pants.option.option_types import ArgsListOption
from pants.option.option_types import ArgsListOption, SkipOption
from pants.util.docutil import git_url


Expand All @@ -23,5 +23,4 @@ class JUnit(JvmToolBase):

args = ArgsListOption(example="--disable-ansi-colors", passthrough=True)

# TODO: Replace with a proper `SkipOption`.
skip = False
skip = SkipOption("test")
3 changes: 1 addition & 2 deletions src/python/pants/backend/python/goals/pytest_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,7 @@ async def setup_pytest_for_target(


class PyTestRequest(TestRequest):
# TODO: Remove the type-ignore after adding a `skip` option to the subsystem.
tool_subsystem = PyTest # type: ignore[assignment]
tool_subsystem = PyTest
field_set_type = PythonTestFieldSet


Expand Down
5 changes: 2 additions & 3 deletions src/python/pants/backend/python/subsystems/pytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from pants.engine.rules import collect_rules, rule
from pants.engine.target import Target
from pants.engine.unions import UnionRule
from pants.option.option_types import ArgsListOption, BoolOption, FileOption, StrOption
from pants.option.option_types import ArgsListOption, BoolOption, FileOption, SkipOption, StrOption
from pants.util.docutil import bin_name, doc_url, git_url
from pants.util.logging import LogLevel
from pants.util.memo import memoized_method
Expand Down Expand Up @@ -146,8 +146,7 @@ class PyTest(PythonToolBase):

export = ExportToolOption()

# TODO: Replace with a proper `SkipOption`.
skip = False
skip = SkipOption("test")

@property
def all_requirements(self) -> tuple[str, ...]:
Expand Down
5 changes: 2 additions & 3 deletions src/python/pants/backend/scala/subsystems/scalatest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from pants.jvm.resolve.jvm_tool import JvmToolBase
from pants.option.option_types import ArgsListOption
from pants.option.option_types import ArgsListOption, SkipOption
from pants.util.docutil import git_url


Expand All @@ -25,5 +25,4 @@ class Scalatest(JvmToolBase):
extra_help="See https://www.scalatest.org/user_guide/using_the_runner for supported arguments.",
)

# TODO: Replace with a proper `SkipOption`.
skip = False
skip = SkipOption("test")
3 changes: 1 addition & 2 deletions src/python/pants/backend/scala/test/scalatest.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ class ScalatestTestFieldSet(TestFieldSet):


class ScalatestTestRequest(TestRequest):
# TODO: Remove the type-ignore after adding a `skip` option to the subsystem.
tool_subsystem = Scalatest # type: ignore[assignment]
tool_subsystem = Scalatest
field_set_type = ScalatestTestFieldSet


Expand Down
4 changes: 2 additions & 2 deletions src/python/pants/backend/shell/shunit2.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from pants.core.util_rules import external_tool
from pants.core.util_rules.external_tool import TemplatedExternalTool
from pants.engine.rules import collect_rules
from pants.option.option_types import SkipOption
from pants.util.meta import classproperty


Expand All @@ -16,8 +17,7 @@ class Shunit2(TemplatedExternalTool):
default_version = "b9102bb763cc603b3115ed30a5648bf950548097"
default_url_template = "https://raw.githubusercontent.com/kward/shunit2/{version}/shunit2"

# TODO: Replace with a proper `SkipOption`.
skip = False
skip = SkipOption("test")

@classproperty
def default_known_versions(cls):
Expand Down
3 changes: 1 addition & 2 deletions src/python/pants/backend/shell/shunit2_test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ def opt_out(cls, tgt: Target) -> bool:


class Shunit2TestRequest(TestRequest):
# TODO: Remove the type-ignore after adding a `skip` option to the subsystem.
tool_subsystem = Shunit2 # type: ignore[assignment]
tool_subsystem = Shunit2
field_set_type = Shunit2FieldSet


Expand Down
3 changes: 1 addition & 2 deletions src/python/pants/jvm/test/junit.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ class JunitTestFieldSet(TestFieldSet):


class JunitTestRequest(TestRequest):
# TODO: Remove the type-ignore after adding a `skip` option to the subsystem.
tool_subsystem = JUnit # type: ignore[assignment]
tool_subsystem = JUnit
field_set_type = JunitTestFieldSet


Expand Down

0 comments on commit 9c6097e

Please sign in to comment.