Skip to content
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

Randomise alliance and station rather than testing all every time #177

Closed
wants to merge 1 commit into from
Closed
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
5 changes: 3 additions & 2 deletions tests/autonomous_test.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import hal
import pytest
import random
from robotpy_ext.autonomous.selector_tests import ( # type: ignore[import-untyped]
test_all_autonomous as _test_all_autonomous,
)
from wpilib.simulation import DriverStationSim


@pytest.mark.slow_integration_test
@pytest.mark.parametrize("alliance", ["Red", "Blue"])
def test_all_autonomous(control, alliance):
def test_all_autonomous(control):
alliance = random.choice(["Red", "Blue"])
station = getattr(hal.AllianceStationID, f"k{alliance}1")
DriverStationSim.setAllianceStationId(station)

Expand Down
8 changes: 4 additions & 4 deletions tests/fuzz_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ def _test_fuzz(
alliance_station_names = [station.name[1:] for station in alliance_stations]


@pytest.mark.parametrize("station", alliance_stations, ids=alliance_station_names)
def test_fuzz(control: TestController, station: hal.AllianceStationID) -> None:
def test_fuzz(control: TestController) -> None:
station = random.choice(alliance_stations)
_test_fuzz(control, station, fuzz_disabled_hids=False)


@pytest.mark.parametrize("station", alliance_stations, ids=alliance_station_names)
def test_fuzz_disabled(control: TestController, station: hal.AllianceStationID) -> None:
def test_fuzz_disabled(control: TestController) -> None:
station = random.choice(alliance_stations)
_test_fuzz(control, station, fuzz_disabled_hids=True)


Expand Down
Loading