Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions launchable_cli_args/subset.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ def fill_and_validate(self, data: dict, error_counter: ErrorCounter):
if data is None:
error_counter.record("subset section is empty")
else:
self.mode: str = data.get("mode", "subset")
if not self.mode in ["subset", "subset_and_rest", "record_only"]:
self.mode: str = data.get("mode", "record-only")
if not self.mode in ["subset", "subset-and-rest", "record-only"]:
error_counter.record(
"'mode' must be subset, subset_and_rest, or record_only")
"'mode' must be subset, subset-and-rest, or record-only")
self.target: Optional[str] = data.get("target", None)
self.confidence: Optional[int] = data.get("confidence", None)
self.time: Optional[int] = data.get("time", None)
Expand All @@ -29,7 +29,7 @@ def fill_and_validate(self, data: dict, error_counter: ErrorCounter):
"one of target/confidence/time must be specified")

def write_to(self, writer: YamlWriter):
writer.comment("mode is subset, subset_and_rest, or record_only")
writer.comment("mode is subset, subset-and-rest, or record-only")
writer.name("mode").value(self.mode)

writer.comment("you must specify one of target/confidence/time")
Expand All @@ -47,7 +47,7 @@ def write_to(self, writer: YamlWriter):
writer.name("time").value(self.time)

def to_command(self) -> "Commands":
if self.mode == "record_only":
if self.mode == "record-only":
return () # subset command is not applicable
else:
a: "Commands" = ("launchable", "subset", "--build",
Expand All @@ -59,7 +59,7 @@ def to_command(self) -> "Commands":
if getattr(self, "time", None) is not None:
a += ("--time", self.time)

if self.mode == "subset_and_rest":
if self.mode == "subset-and-rest":
a += ("--rest", SubsetArgs.REST_FILE_NAME)

a += ("pytest", )
Expand Down
2 changes: 1 addition & 1 deletion pytest_launchable/launchable_test_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def pytest_collection_modifyitems(config, items: List[pytest.Function]) -> None:
lc.set_subset_command_request(subset_command, testpath_list)
raw_subset_result = subprocess.run(subset_command, input="\r\n".join(
testpath_list), stdout=subprocess.PIPE, text=True)
if cli.subset.mode == "subset_and_rest":
if cli.subset.mode == "subset-and-rest":
lc.set_subset_command_response(
raw_subset_result.stdout, cli.subset.REST_FILE_NAME)
else:
Expand Down
8 changes: 4 additions & 4 deletions tests/test_configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ def test_command() -> None:
assert args.subset.to_command() == ("launchable", "subset", "--build",
"XXX", "--target", "30%", "pytest")

# subset_and_rest mode
args.subset.mode = "subset_and_rest"
# subset-and-rest mode
args.subset.mode = "subset-and-rest"
assert args.subset.to_command() == ("launchable", "subset", "--build", "XXX",
"--target", "30%", "--rest", args.subset.REST_FILE_NAME, "pytest")

# record_only mode / skip subset service, record test command only
args.subset.mode = "record_only"
# record-only mode / skip subset service, record test command only
args.subset.mode = "record-only"
assert args.subset.to_command() == ()