Skip to content

Commit

Permalink
Better bail out if pytest args not provided
Browse files Browse the repository at this point in the history
  • Loading branch information
cognifloyd committed Dec 19, 2024
1 parent 79752cb commit 4201a33
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,14 @@ def pytest_addoption(parser):
"--test-group-count",
dest="test-group-count",
type=int,
default=-1,
help="The number of groups to split the tests into",
)
group.addoption(
"--test-group",
dest="test-group",
type=int,
default=-1,
help="The group of tests that should be executed",
)

Expand All @@ -74,7 +76,7 @@ def pytest_collection_modifyitems(session, config, items: List[nodes.Node]):
group_count = config.getoption("test-group-count")
group_id = config.getoption("test-group")

if not group_count or not group_id:
if group_count < 1 or group_id < 0:
return

items[:] = get_group(items, group_count, group_id)
Expand Down

0 comments on commit 4201a33

Please sign in to comment.