Skip to content

Commit 487994a

Browse files
auscompgeekjames-ward
authored andcommitted
fuzz_test: Use env var to determine alliance stations to fuzz
1 parent 418dd79 commit 487994a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tests/fuzz_test.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,23 @@ def fuzz_xbox_gamepad(gamepad: wpilib.simulation.XboxControllerSim) -> None:
8080

8181

8282
def get_alliance_stations() -> list[str]:
83+
choices_env_var = "FUZZ_ALLIANCE_STATIONS"
84+
choices_env = os.environ.get(choices_env_var, None)
85+
if choices_env is not None: # pragma: no cover
86+
return choices_env.split(",")
87+
8388
stations = (1, 2, 3)
8489
if "CI" in os.environ: # pragma: no branch
85-
return [
90+
choices = [
8691
f"{alliance}{station}"
8792
for alliance in ("Blue", "Red")
8893
for station in stations
8994
]
9095
else: # pragma: no cover
91-
return [f"Blue{random.choice(stations)}", f"Red{random.choice(stations)}"]
96+
choices = [f"Blue{random.choice(stations)}", f"Red{random.choice(stations)}"]
97+
98+
os.environ[choices_env_var] = ",".join(choices)
99+
return choices
92100

93101

94102
@pytest.mark.parametrize("station", get_alliance_stations())

0 commit comments

Comments
 (0)