Skip to content

Commit e082cb8

Browse files
committed
Clean up changes some more
1 parent eb9c3ab commit e082cb8

4 files changed

Lines changed: 5 additions & 32 deletions

File tree

src/software/ai/hl/stp/tactic/move/move_tactic_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def setup():
6767
# Robot stays at destination for one second
6868
[
6969
DurationValidation(
70-
duration_s=1, validation=RobotEventuallyAtPosition(1, destination)
70+
duration_s=10, validation=RobotEventuallyAtPosition(1, destination)
7171
)
7272
]
7373
]

src/software/gameplay_tests/fixture.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,6 @@ def bound_runner(session):
144144
def simulated_session(args, runtime_subpath):
145145
"""Launches the simulator, blue/yellow full systems, and gamecontroller.
146146
147-
Sets up their ProtoUnixIOs and keeps the binaries alive for the duration of
148-
the context. Used both per-test (simulated_test_runner) and once for the
149-
whole session (test mode).
150-
151147
:param args: Parsed command-line arguments.
152148
:param runtime_subpath: Subdirectory (under each runtime dir) for this session.
153149
:yields: A SessionContext with the live ProtoUnixIOs and gamecontroller.
@@ -212,10 +208,6 @@ def simulated_session(args, runtime_subpath):
212208
def field_session(args, runtime_subpath):
213209
"""Launches the friendly full system, gamecontroller, WiFi, and robot comms.
214210
215-
Sets up their ProtoUnixIOs, puts all robots under AI control, and keeps the
216-
binaries alive for the duration of the context. Used both per-test
217-
(field_test_runner) and once for the whole session (test mode).
218-
219211
:param args: Parsed command-line arguments.
220212
:param runtime_subpath: Subdirectory (under each runtime dir) for this session.
221213
:yields: A SessionContext with the live ProtoUnixIOs, gamecontroller,
@@ -297,9 +289,6 @@ def field_session(args, runtime_subpath):
297289
def wire_field_keyboard_estop(thunderscope, robot_communication, estop_mode):
298290
"""Connects Thunderscope's keyboard estop shortcut to robot communication.
299291
300-
Only does anything in keyboard estop mode; enables the estop immediately so
301-
a field test can start moving robots as soon as it runs.
302-
303292
:param thunderscope: The Thunderscope instance.
304293
:param robot_communication: The RobotCommunication instance.
305294
:param estop_mode: The EstopMode in use.
@@ -341,8 +330,6 @@ def build_field_test_thunderscope(
341330
):
342331
"""Builds a Thunderscope with the field-test view bound to a session.
343332
344-
Also wires up the keyboard estop for the session's robot communication.
345-
346333
:param session: the SessionContext whose ProtoUnixIOs to visualize.
347334
:param yellow_is_friendly: whether the friendly team is yellow.
348335
:param layout_path: the Thunderscope layout to load, or None.

src/software/gameplay_tests/tbots_test_runner.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ def __init__(
4545
self.gamecontroller = gamecontroller
4646
self.is_yellow_friendly = is_yellow_friendly
4747
self.owns_thunderscope = owns_thunderscope
48-
# Optional Event used to stop the test loop early (set in test mode when
49-
# the user selects another test to run). None when not bound.
5048
self.cancel_event = None
5149
self.world_buffer = ThreadSafeBuffer(buffer_size=20, protobuf_type=World)
5250
self.primitive_set_buffer = ThreadSafeBuffer(
@@ -61,9 +59,6 @@ def __init__(
6159
buffer_size=1, protobuf_type=RobotStatus
6260
)
6361

64-
# Track every (proto_unix_io, proto_class, buffer) we register so that
65-
# cleanup() can deregister them. This keeps long-lived ProtoUnixIOs
66-
# (test mode) from accumulating dead buffers across runs.
6762
self._registered_observers = []
6863

6964
self._register_observer(
@@ -196,20 +191,16 @@ def run_test(
196191
"""
197192
self._pre_run_setup(setup)
198193

194+
threading.excepthook = self._excepthook
195+
199196
args = (
200197
always_validation_sequence_set,
201198
eventually_validation_sequence_set,
202199
test_timeout_s,
203200
gc_cmd_with_delay,
204201
)
205202

206-
# When we own the Thunderscope, run the test loop on a background thread
207-
# and block the main thread on the Qt event loop. When bound to an
208-
# already-open Thunderscope (test mode), we are already off the main
209-
# thread, so run the loop inline.
210203
if self.thunderscope and self.owns_thunderscope:
211-
threading.excepthook = self._excepthook
212-
213204
run_test_thread = threading.Thread(
214205
target=self._runner, daemon=True, args=args
215206
)

src/software/gameplay_tests/util.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,7 @@ def pytest_main(file):
205205
def _file_has_gameplay_test(path: str) -> bool:
206206
"""Returns whether a Python file defines a test using gameplay_test_runner.
207207
208-
Parses the file and looks for a test function (named test*) that requests the
209-
gameplay_test_runner fixture as a parameter. Using the AST instead of a text
210-
search avoids false positives and does not require importing the module.
208+
Parses the file and looks for a test function with gameplay_test_runner as a parameter.
211209
212210
:param path: absolute path to the Python file to inspect.
213211
:return: True if the file contains a gameplay_test_runner test.
@@ -235,10 +233,7 @@ def _file_has_gameplay_test(path: str) -> bool:
235233
def discover_tests() -> list[tuple[str, str]]:
236234
"""Discovers gameplay tests from the workspace source tree.
237235
238-
Returns every test file containing a test that uses the gameplay_test_runner
239-
fixture. Such tests run as both simulated and field tests, so the same list
240-
is offered in either mode; the _field_test.py naming is only a convention
241-
(typically simpler, fewer-robot tests) and is not used to filter.
236+
Returns every test file containing a test that uses the gameplay_test_runner fixture.
242237
243238
:return: list of (display_name, absolute_path) tuples, sorted by name.
244239
"""

0 commit comments

Comments
 (0)