From a444080c71daef02ba435e484a4934af5fd4f722 Mon Sep 17 00:00:00 2001 From: Eric Xiao Date: Tue, 26 May 2026 12:34:22 -0700 Subject: [PATCH 01/18] Add new gameplay_tests package with pytest fixture and runners --- src/software/BUILD | 1 + src/software/ai/hl/stp/tactic/move/BUILD | 1 + .../ai/hl/stp/tactic/move/move_tactic_test.py | 452 +++++++++--------- src/software/conftest.py | 1 + src/software/gameplay_tests/fixture.py | 116 +++++ src/software/gameplay_tests/requirements.in | 1 + .../gameplay_tests/requirements_lock.txt | 34 ++ .../gameplay_tests/simulated_test_runner.py | 402 ++++++++++++++++ .../gameplay_tests/tbots_test_runner.py | 158 ++++++ src/software/gameplay_tests/util.py | 108 +++++ 10 files changed, 1050 insertions(+), 224 deletions(-) create mode 100644 src/software/gameplay_tests/fixture.py create mode 100644 src/software/gameplay_tests/requirements.in create mode 100644 src/software/gameplay_tests/requirements_lock.txt create mode 100644 src/software/gameplay_tests/simulated_test_runner.py create mode 100644 src/software/gameplay_tests/tbots_test_runner.py create mode 100644 src/software/gameplay_tests/util.py diff --git a/src/software/BUILD b/src/software/BUILD index dbafc6f2e8..bfc68c106d 100644 --- a/src/software/BUILD +++ b/src/software/BUILD @@ -127,5 +127,6 @@ py_library( deps = [ "//software/field_tests:field_test_fixture", "//software/simulated_tests:simulated_test_fixture", + "//software/gameplay_tests:fixture", ], ) diff --git a/src/software/ai/hl/stp/tactic/move/BUILD b/src/software/ai/hl/stp/tactic/move/BUILD index 8d772fd72d..966f452179 100644 --- a/src/software/ai/hl/stp/tactic/move/BUILD +++ b/src/software/ai/hl/stp/tactic/move/BUILD @@ -39,6 +39,7 @@ py_test( deps = [ "//software:conftest", "//software/simulated_tests/validation:validations", + "//software/gameplay_tests:util", requirement("pytest"), ], ) diff --git a/src/software/ai/hl/stp/tactic/move/move_tactic_test.py b/src/software/ai/hl/stp/tactic/move/move_tactic_test.py index 6b3e53fd83..d1179f0508 100644 --- a/src/software/ai/hl/stp/tactic/move/move_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/move/move_tactic_test.py @@ -17,20 +17,24 @@ RobotEventuallyAtAngularVelocity, ) from software.simulated_tests.validation.duration_validation import DurationValidation -from software.simulated_tests.simulated_test_fixture import ( + +# from software.simulated_tests.simulated_test_fixture import ( +# pytest_main, +# ) +from software.gameplay_tests.util import ( pytest_main, ) from proto.message_translation.tbots_protobuf import create_world_state from proto.import_all_protos import * -def test_move_across_field(simulated_test_runner): +def test_move_across_field(gameplay_test_runner): initial_position = tbots_cpp.Point(-3, 1.5) destination = tbots_cpp.Point(2.5, -1.1) field = tbots_cpp.Field.createSSLDivisionBField() def setup(*args): - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[ tbots_cpp.Point(-3, 2.5), @@ -49,7 +53,7 @@ def setup(*args): ), ) - simulated_test_runner.set_tactics( + gameplay_test_runner.set_tactics( blue_tactics={ 1: MoveTactic( destination=tbots_cpp.createPointProto(destination), @@ -69,7 +73,7 @@ def setup(*args): ] ] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_eventually_validation_sequence_set=eventually_validation_sequence_set, ag_eventually_validation_sequence_set=eventually_validation_sequence_set, @@ -77,225 +81,225 @@ def setup(*args): ) -def test_autochip_move(simulated_test_runner): - initial_position = tbots_cpp.Point(-3, 1.5) - destination = tbots_cpp.Point(0, 1.5) - field = tbots_cpp.Field.createSSLDivisionBField() - - def setup(*args): - simulated_test_runner.set_world_state( - create_world_state( - blue_robot_locations=[ - tbots_cpp.Point(-3, 2.5), - initial_position, - ], - yellow_robot_locations=[ - tbots_cpp.Point(1, 0), - tbots_cpp.Point(1, 2.5), - tbots_cpp.Point(1, -2.5), - field.enemyGoalCenter(), - field.enemyDefenseArea().negXNegYCorner(), - field.enemyDefenseArea().negXPosYCorner(), - ], - ball_location=destination, - ball_velocity=tbots_cpp.Vector(0, 0), - ), - ) - - simulated_test_runner.set_tactics( - blue_tactics={ - 1: MoveTactic( - destination=tbots_cpp.createPointProto(destination), - final_orientation=tbots_cpp.createAngleProto( - tbots_cpp.Angle.zero() - ), - dribbler_mode=DribblerMode.OFF, - ball_collision_type=BallCollisionType.ALLOW, - auto_chip_or_kick=AutoChipOrKick(autochip_distance_meters=2.0), - max_allowed_speed_mode=MaxAllowedSpeedMode.COLLISIONS_ALLOWED, - obstacle_avoidance_mode=ObstacleAvoidanceMode.SAFE, - ) - } - ) - - eventually_validation_sequence_set = [ - [ - # Robot moves to position and chips ball - RobotEventuallyAtPosition(1, destination), - BallEventuallyKickedInDirection(tbots_cpp.Angle.zero()), - BallIsEventuallyOffGround(), - # Robot stays at destination for one second - DurationValidation( - duration_s=1, validation=RobotEventuallyAtPosition(1, destination) - ), - ] - ] - - simulated_test_runner.run_test( - setup=setup, - inv_eventually_validation_sequence_set=eventually_validation_sequence_set, - ag_eventually_validation_sequence_set=eventually_validation_sequence_set, - test_timeout_s=10, - ) - - -def test_autokick_move(simulated_test_runner): - initial_position = tbots_cpp.Point(-1, -0.5) - destination = tbots_cpp.Point(-1, -1) - field = tbots_cpp.Field.createSSLDivisionBField() - - def setup(*args): - simulated_test_runner.set_world_state( - create_world_state( - blue_robot_locations=[initial_position], - blue_robot_orientations=[tbots_cpp.Angle.threeQuarter()], - yellow_robot_locations=[ - tbots_cpp.Point(1, 0), - tbots_cpp.Point(1, 2.5), - tbots_cpp.Point(1, -2.5), - field.enemyGoalCenter(), - field.enemyDefenseArea().negXNegYCorner(), - field.enemyDefenseArea().negXPosYCorner(), - ], - ball_location=destination, - ball_velocity=tbots_cpp.Vector(0, 0), - ), - ) - - simulated_test_runner.set_tactics( - blue_tactics={ - 0: MoveTactic( - destination=tbots_cpp.createPointProto(destination), - final_orientation=tbots_cpp.createAngleProto( - tbots_cpp.Angle.threeQuarter() - ), - dribbler_mode=DribblerMode.OFF, - ball_collision_type=BallCollisionType.ALLOW, - auto_chip_or_kick=AutoChipOrKick(autokick_speed_m_per_s=3.0), - max_allowed_speed_mode=MaxAllowedSpeedMode.COLLISIONS_ALLOWED, - obstacle_avoidance_mode=ObstacleAvoidanceMode.SAFE, - ) - } - ) - - eventually_validation_sequence_set = [ - [ - # Robot moves to destination and kicks - RobotEventuallyAtPosition(0, destination), - BallEventuallyKickedInDirection(tbots_cpp.Angle.threeQuarter()), - # Robot stays at destination for one second - DurationValidation( - duration_s=1, validation=RobotEventuallyAtPosition(0, destination) - ), - ] - ] - - simulated_test_runner.run_test( - setup=setup, - inv_eventually_validation_sequence_set=eventually_validation_sequence_set, - ag_eventually_validation_sequence_set=eventually_validation_sequence_set, - test_timeout_s=5, - ) - - -@pytest.mark.parametrize( - "orientation, initial_position, destination, angular_velocity", - [ - # Robot facing right, should rotate counter clockwise to face up - ( - tbots_cpp.Angle.quarter(), - tbots_cpp.Point(2, 0), - tbots_cpp.Point(-2, 0), - tbots_cpp.Angle.fromDegrees(360), - ), - # Robot facing right, should rotate clockwise to face down - ( - tbots_cpp.Angle.threeQuarter(), - tbots_cpp.Point(2, 0), - tbots_cpp.Point(-2, 0), - tbots_cpp.Angle.fromDegrees(-360), - ), - # Robot facing right, should rotate counter clockwise to face up - ( - tbots_cpp.Angle.quarter(), - tbots_cpp.Point(0, 0), - tbots_cpp.Point(0, 0), - tbots_cpp.Angle.fromDegrees(360), - ), - # Robot facing right, should rotate clockwise to face down - ( - tbots_cpp.Angle.threeQuarter(), - tbots_cpp.Point(0, 0), - tbots_cpp.Point(0, 0), - tbots_cpp.Angle.fromDegrees(-360), - ), - # Robot facing right, should rotate counter clockwise to face left, slightly up - ( - tbots_cpp.Angle.fromDegrees(175), - tbots_cpp.Point(3, -1), - tbots_cpp.Point(0, 1), - tbots_cpp.Angle.fromDegrees(360), - ), - # Robot facing right, should rotate clockwise to face down - ( - tbots_cpp.Angle.fromDegrees(185), - tbots_cpp.Point(3, -1), - tbots_cpp.Point(0, 1), - tbots_cpp.Angle.fromDegrees(-360), - ), - ], -) -def test_spinning_move( - orientation, initial_position, destination, angular_velocity, simulated_test_runner -): - def setup(*args): - simulated_test_runner.set_world_state( - create_world_state( - blue_robot_locations=[initial_position], - yellow_robot_locations=[tbots_cpp.Point(4, 0)], - ball_location=tbots_cpp.Point(1, 1), - ball_velocity=tbots_cpp.Vector(0, 0), - ), - ) - - simulated_test_runner.set_tactics( - blue_tactics={ - 0: MoveTactic( - destination=tbots_cpp.createPointProto(destination), - final_orientation=tbots_cpp.createAngleProto(orientation), - dribbler_mode=DribblerMode.OFF, - ball_collision_type=BallCollisionType.ALLOW, - auto_chip_or_kick=AutoChipOrKick(), - max_allowed_speed_mode=MaxAllowedSpeedMode.PHYSICAL_LIMIT, - obstacle_avoidance_mode=ObstacleAvoidanceMode.SAFE, - ) - } - ) - - eventually_validation_sequence_set = [ - [ - # High threshold to check direction of angular velocity - RobotEventuallyAtAngularVelocity(0, angular_velocity, 4), - # Robot stays at destination for one second - DurationValidation( - duration_s=1, validation=RobotEventuallyAtPosition(0, destination) - ), - ], - [ - # Robot stays at orientation for one second once it has reached the destination - RobotEventuallyAtPosition(0, destination), - DurationValidation( - duration_s=1, validation=RobotEventuallyAtOrientation(0, orientation) - ), - ], - ] - - simulated_test_runner.run_test( - setup=setup, - inv_eventually_validation_sequence_set=eventually_validation_sequence_set, - ag_eventually_validation_sequence_set=eventually_validation_sequence_set, - test_timeout_s=5, - ) +# def test_autochip_move(simulated_test_runner): +# initial_position = tbots_cpp.Point(-3, 1.5) +# destination = tbots_cpp.Point(0, 1.5) +# field = tbots_cpp.Field.createSSLDivisionBField() +# +# def setup(*args): +# simulated_test_runner.set_world_state( +# create_world_state( +# blue_robot_locations=[ +# tbots_cpp.Point(-3, 2.5), +# initial_position, +# ], +# yellow_robot_locations=[ +# tbots_cpp.Point(1, 0), +# tbots_cpp.Point(1, 2.5), +# tbots_cpp.Point(1, -2.5), +# field.enemyGoalCenter(), +# field.enemyDefenseArea().negXNegYCorner(), +# field.enemyDefenseArea().negXPosYCorner(), +# ], +# ball_location=destination, +# ball_velocity=tbots_cpp.Vector(0, 0), +# ), +# ) +# +# simulated_test_runner.set_tactics( +# blue_tactics={ +# 1: MoveTactic( +# destination=tbots_cpp.createPointProto(destination), +# final_orientation=tbots_cpp.createAngleProto( +# tbots_cpp.Angle.zero() +# ), +# dribbler_mode=DribblerMode.OFF, +# ball_collision_type=BallCollisionType.ALLOW, +# auto_chip_or_kick=AutoChipOrKick(autochip_distance_meters=2.0), +# max_allowed_speed_mode=MaxAllowedSpeedMode.COLLISIONS_ALLOWED, +# obstacle_avoidance_mode=ObstacleAvoidanceMode.SAFE, +# ) +# } +# ) +# +# eventually_validation_sequence_set = [ +# [ +# # Robot moves to position and chips ball +# RobotEventuallyAtPosition(1, destination), +# BallEventuallyKickedInDirection(tbots_cpp.Angle.zero()), +# BallIsEventuallyOffGround(), +# # Robot stays at destination for one second +# DurationValidation( +# duration_s=1, validation=RobotEventuallyAtPosition(1, destination) +# ), +# ] +# ] +# +# simulated_test_runner.run_test( +# setup=setup, +# inv_eventually_validation_sequence_set=eventually_validation_sequence_set, +# ag_eventually_validation_sequence_set=eventually_validation_sequence_set, +# test_timeout_s=10, +# ) +# +# +# def test_autokick_move(simulated_test_runner): +# initial_position = tbots_cpp.Point(-1, -0.5) +# destination = tbots_cpp.Point(-1, -1) +# field = tbots_cpp.Field.createSSLDivisionBField() +# +# def setup(*args): +# simulated_test_runner.set_world_state( +# create_world_state( +# blue_robot_locations=[initial_position], +# blue_robot_orientations=[tbots_cpp.Angle.threeQuarter()], +# yellow_robot_locations=[ +# tbots_cpp.Point(1, 0), +# tbots_cpp.Point(1, 2.5), +# tbots_cpp.Point(1, -2.5), +# field.enemyGoalCenter(), +# field.enemyDefenseArea().negXNegYCorner(), +# field.enemyDefenseArea().negXPosYCorner(), +# ], +# ball_location=destination, +# ball_velocity=tbots_cpp.Vector(0, 0), +# ), +# ) +# +# simulated_test_runner.set_tactics( +# blue_tactics={ +# 0: MoveTactic( +# destination=tbots_cpp.createPointProto(destination), +# final_orientation=tbots_cpp.createAngleProto( +# tbots_cpp.Angle.threeQuarter() +# ), +# dribbler_mode=DribblerMode.OFF, +# ball_collision_type=BallCollisionType.ALLOW, +# auto_chip_or_kick=AutoChipOrKick(autokick_speed_m_per_s=3.0), +# max_allowed_speed_mode=MaxAllowedSpeedMode.COLLISIONS_ALLOWED, +# obstacle_avoidance_mode=ObstacleAvoidanceMode.SAFE, +# ) +# } +# ) +# +# eventually_validation_sequence_set = [ +# [ +# # Robot moves to destination and kicks +# RobotEventuallyAtPosition(0, destination), +# BallEventuallyKickedInDirection(tbots_cpp.Angle.threeQuarter()), +# # Robot stays at destination for one second +# DurationValidation( +# duration_s=1, validation=RobotEventuallyAtPosition(0, destination) +# ), +# ] +# ] +# +# simulated_test_runner.run_test( +# setup=setup, +# inv_eventually_validation_sequence_set=eventually_validation_sequence_set, +# ag_eventually_validation_sequence_set=eventually_validation_sequence_set, +# test_timeout_s=5, +# ) +# +# +# @pytest.mark.parametrize( +# "orientation, initial_position, destination, angular_velocity", +# [ +# # Robot facing right, should rotate counter clockwise to face up +# ( +# tbots_cpp.Angle.quarter(), +# tbots_cpp.Point(2, 0), +# tbots_cpp.Point(-2, 0), +# tbots_cpp.Angle.fromDegrees(360), +# ), +# # Robot facing right, should rotate clockwise to face down +# ( +# tbots_cpp.Angle.threeQuarter(), +# tbots_cpp.Point(2, 0), +# tbots_cpp.Point(-2, 0), +# tbots_cpp.Angle.fromDegrees(-360), +# ), +# # Robot facing right, should rotate counter clockwise to face up +# ( +# tbots_cpp.Angle.quarter(), +# tbots_cpp.Point(0, 0), +# tbots_cpp.Point(0, 0), +# tbots_cpp.Angle.fromDegrees(360), +# ), +# # Robot facing right, should rotate clockwise to face down +# ( +# tbots_cpp.Angle.threeQuarter(), +# tbots_cpp.Point(0, 0), +# tbots_cpp.Point(0, 0), +# tbots_cpp.Angle.fromDegrees(-360), +# ), +# # Robot facing right, should rotate counter clockwise to face left, slightly up +# ( +# tbots_cpp.Angle.fromDegrees(175), +# tbots_cpp.Point(3, -1), +# tbots_cpp.Point(0, 1), +# tbots_cpp.Angle.fromDegrees(360), +# ), +# # Robot facing right, should rotate clockwise to face down +# ( +# tbots_cpp.Angle.fromDegrees(185), +# tbots_cpp.Point(3, -1), +# tbots_cpp.Point(0, 1), +# tbots_cpp.Angle.fromDegrees(-360), +# ), +# ], +# ) +# def test_spinning_move( +# orientation, initial_position, destination, angular_velocity, simulated_test_runner +# ): +# def setup(*args): +# simulated_test_runner.set_world_state( +# create_world_state( +# blue_robot_locations=[initial_position], +# yellow_robot_locations=[tbots_cpp.Point(4, 0)], +# ball_location=tbots_cpp.Point(1, 1), +# ball_velocity=tbots_cpp.Vector(0, 0), +# ), +# ) +# +# simulated_test_runner.set_tactics( +# blue_tactics={ +# 0: MoveTactic( +# destination=tbots_cpp.createPointProto(destination), +# final_orientation=tbots_cpp.createAngleProto(orientation), +# dribbler_mode=DribblerMode.OFF, +# ball_collision_type=BallCollisionType.ALLOW, +# auto_chip_or_kick=AutoChipOrKick(), +# max_allowed_speed_mode=MaxAllowedSpeedMode.PHYSICAL_LIMIT, +# obstacle_avoidance_mode=ObstacleAvoidanceMode.SAFE, +# ) +# } +# ) +# +# eventually_validation_sequence_set = [ +# [ +# # High threshold to check direction of angular velocity +# RobotEventuallyAtAngularVelocity(0, angular_velocity, 4), +# # Robot stays at destination for one second +# DurationValidation( +# duration_s=1, validation=RobotEventuallyAtPosition(0, destination) +# ), +# ], +# [ +# # Robot stays at orientation for one second once it has reached the destination +# RobotEventuallyAtPosition(0, destination), +# DurationValidation( +# duration_s=1, validation=RobotEventuallyAtOrientation(0, orientation) +# ), +# ], +# ] +# +# simulated_test_runner.run_test( +# setup=setup, +# inv_eventually_validation_sequence_set=eventually_validation_sequence_set, +# ag_eventually_validation_sequence_set=eventually_validation_sequence_set, +# test_timeout_s=5, +# ) if __name__ == "__main__": diff --git a/src/software/conftest.py b/src/software/conftest.py index 61da04ba49..0de2a5f4da 100644 --- a/src/software/conftest.py +++ b/src/software/conftest.py @@ -1,6 +1,7 @@ import pytest # noqa: F401 from software.simulated_tests.simulated_test_fixture import simulated_test_runner # noqa: F401 from software.field_tests.field_test_fixture import field_test_runner # noqa: F401 +from software.gameplay_tests.fixture import gameplay_test_runner # Pytest requires that all tests fixtures shared across a package be defined # in a single conftest.py file in the parent directory of the package. diff --git a/src/software/gameplay_tests/fixture.py b/src/software/gameplay_tests/fixture.py new file mode 100644 index 0000000000..2e08750267 --- /dev/null +++ b/src/software/gameplay_tests/fixture.py @@ -0,0 +1,116 @@ +import os +import time + +import pytest + +from software.gameplay_tests.util import load_command_line_arguments +from software.gameplay_tests.simulated_test_runner import ( + InvariantTestRunner, + AggregateTestRunner, +) +from software.thunderscope.binary_context_managers.full_system import FullSystem +from software.thunderscope.binary_context_managers.game_controller import Gamecontroller +from software.thunderscope.binary_context_managers.simulator import Simulator +from software.thunderscope.proto_unix_io import ProtoUnixIO +from software.thunderscope.thunderscope import Thunderscope +from software.thunderscope.thunderscope_config import configure_simulated_test_view + +LAUNCH_DELAY_S = 0.1 + + +@pytest.fixture +def gameplay_test_runner(): + args = load_command_line_arguments() + tscope = None + + aggregate = args.aggregate + + simulator_proto_unix_io = ProtoUnixIO() + yellow_full_system_proto_unix_io = ProtoUnixIO() + blue_full_system_proto_unix_io = ProtoUnixIO() + + # Grab the current test name to store the proto log for the test case + current_test = os.environ.get("PYTEST_CURRENT_TEST").split(":")[-1].split(" ")[0] + current_test = current_test.replace("]", "") + current_test = current_test.replace("[", "-") + + test_name = current_test.split("-")[0] + + # Launch all binaries + with ( + Simulator( + f"{args.simulator_runtime_dir}/test/{test_name}", + args.debug_simulator, + args.enable_realism, + ) as simulator, + FullSystem( + "software/unix_full_system", + f"{args.blue_full_system_runtime_dir}/test/{test_name}", + args.debug_blue_full_system, + False, + should_restart_on_crash=False, + running_in_realtime=args.enable_thunderscope, + ) as blue_fs, + FullSystem( + "software/unix_full_system", + f"{args.yellow_full_system_runtime_dir}/test/{test_name}", + args.debug_yellow_full_system, + True, + should_restart_on_crash=False, + running_in_realtime=args.enable_thunderscope, + ) as yellow_fs, + ): + with Gamecontroller( + suppress_logs=(not args.show_gamecontroller_logs) + ) as gamecontroller: + blue_fs.setup_proto_unix_io(blue_full_system_proto_unix_io) + yellow_fs.setup_proto_unix_io(yellow_full_system_proto_unix_io) + simulator.setup_proto_unix_io( + simulator_proto_unix_io, + blue_full_system_proto_unix_io, + yellow_full_system_proto_unix_io, + ProtoUnixIO(), + ) + gamecontroller.setup_proto_unix_io( + blue_full_system_proto_unix_io=blue_full_system_proto_unix_io, + yellow_full_system_proto_unix_io=yellow_full_system_proto_unix_io, + simulator_proto_unix_io=simulator_proto_unix_io, + ) + + # If we want to run thunderscope, inject the proto unix ios + # and start the test + if args.enable_thunderscope: + tscope = Thunderscope( + configure_simulated_test_view( + blue_full_system_proto_unix_io=blue_full_system_proto_unix_io, + yellow_full_system_proto_unix_io=yellow_full_system_proto_unix_io, + simulator_proto_unix_io=simulator_proto_unix_io, + ), + layout_path=args.layout, + ) + + time.sleep(LAUNCH_DELAY_S) + + runner = None + + # Initialise the right runner based on which testing mode is selected + if aggregate: + runner = AggregateTestRunner( + current_test, + tscope, + simulator_proto_unix_io, + blue_full_system_proto_unix_io, + yellow_full_system_proto_unix_io, + gamecontroller, + ) + else: + runner = InvariantTestRunner( + current_test, + tscope, + simulator_proto_unix_io, + blue_full_system_proto_unix_io, + yellow_full_system_proto_unix_io, + gamecontroller, + ) + + yield runner diff --git a/src/software/gameplay_tests/requirements.in b/src/software/gameplay_tests/requirements.in new file mode 100644 index 0000000000..927094516e --- /dev/null +++ b/src/software/gameplay_tests/requirements.in @@ -0,0 +1 @@ +pytest==6.2.5 diff --git a/src/software/gameplay_tests/requirements_lock.txt b/src/software/gameplay_tests/requirements_lock.txt new file mode 100644 index 0000000000..8bf6d03071 --- /dev/null +++ b/src/software/gameplay_tests/requirements_lock.txt @@ -0,0 +1,34 @@ +# +# This file is autogenerated by pip-compile with Python 3.12 +# by the following command: +# +# bazel run //software/simulated_tests:requirements.update +# +attrs==23.2.0 \ + --hash=sha256:935dc3b529c262f6cf76e50877d35a4bd3c1de194fd41f47a2b7ae8f19971f30 \ + --hash=sha256:99b87a485a5820b23b879f04c2305b44b951b502fd64be915879d77a7e8fc6f1 + # via pytest +iniconfig==2.0.0 \ + --hash=sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3 \ + --hash=sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374 + # via pytest +packaging==24.1 \ + --hash=sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002 \ + --hash=sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124 + # via pytest +pluggy==1.5.0 \ + --hash=sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1 \ + --hash=sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669 + # via pytest +py==1.11.0 \ + --hash=sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719 \ + --hash=sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378 + # via pytest +pytest==6.2.5 \ + --hash=sha256:131b36680866a76e6781d13f101efb86cf674ebb9762eb70d3082b6f29889e89 \ + --hash=sha256:7310f8d27bc79ced999e760ca304d69f6ba6c6649c0b60fb0e04a4a77cacc134 + # via -r software/simulated_tests/requirements.in +toml==0.10.2 \ + --hash=sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b \ + --hash=sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f + # via pytest diff --git a/src/software/gameplay_tests/simulated_test_runner.py b/src/software/gameplay_tests/simulated_test_runner.py new file mode 100644 index 0000000000..510e448616 --- /dev/null +++ b/src/software/gameplay_tests/simulated_test_runner.py @@ -0,0 +1,402 @@ +import queue +import threading +import time +from typing import override + +import pytest +from software.py_constants import MILLISECONDS_PER_SECOND + +from proto.import_all_protos import * +from software.logger.logger import create_logger +from software.simulated_tests.tbots_test_runner import TbotsTestRunner +from software.simulated_tests.validation import validation +from software.thunderscope.thread_safe_buffer import ThreadSafeBuffer + +logger = create_logger(__name__) + +LAUNCH_DELAY_S = 0.1 +WORLD_BUFFER_TIMEOUT = 0.5 +PROCESS_BUFFER_DELAY_S = 0.01 +PAUSE_AFTER_FAIL_DELAY_S = 3 + + +class SimulatedTestRunner(TbotsTestRunner): + """Run a simulated test""" + + def __init__( + self, + test_name, + thunderscope, + simulator_proto_unix_io, + blue_full_system_proto_unix_io, + yellow_full_system_proto_unix_io, + gamecontroller, + ): + """Initialize the SimulatorTestRunner + + :param test_name: The name of the test to run + :param thunderscope: The Thunderscope to use, None if not used + :param simulator_proto_unix_io: The simulator proto unix io to use + :param blue_full_system_proto_unix_io: The blue full system proto unix io to use + :param yellow_full_system_proto_unix_io: The yellow full system proto unix io to use + :param gamecontroller: The gamecontroller context managed instance + """ + super(SimulatedTestRunner, self).__init__( + test_name, + thunderscope, + blue_full_system_proto_unix_io, + yellow_full_system_proto_unix_io, + gamecontroller, + ) + self.simulator_proto_unix_io = simulator_proto_unix_io + + @override + def set_world_state(self, worldstate: WorldState): + """Sets the simulation worldstate + + :param worldstate: proto containing the desired worldstate + """ + self.simulator_proto_unix_io.send_proto(WorldState, worldstate) + + def excepthook(self, args): + """This function is _critical_ for show_thunderscope to work. + If the test Thread will raises an exception we won't be able to close + the window from the main thread. + + :param args: The args passed in from the hook + """ + self.__stopper(delay=PAUSE_AFTER_FAIL_DELAY_S) + self.last_exception = args.exc_value + raise self.last_exception + + def __stopper(self, delay=PROCESS_BUFFER_DELAY_S): + """Stop running the test + + :param delay: How long to wait before closing everything, defaults + to PROCESS_BUFFER_DELAY_S to minimize buffer warnings + """ + time.sleep(delay) + + if self.thunderscope: + self.thunderscope.close() + + def sync_setup(self, setup, param): + """Run setup until simulator has received game state + + :param setup: Function that sets up the world state + :param param: Parameter passed into setup + """ + world_state_received_buffer = ThreadSafeBuffer(1, WorldStateReceivedTrigger) + self.simulator_proto_unix_io.register_observer( + WorldStateReceivedTrigger, world_state_received_buffer + ) + + while True: + setup(param) + + try: + world_state_received_buffer.get( + block=True, timeout=WORLD_BUFFER_TIMEOUT + ) + except queue.Empty: + # Did not receive a response within timeout period + continue + else: + # Received a response from the simulator + break + + def runner( + self, + always_validation_sequence_set, + eventually_validation_sequence_set, + test_timeout_s, + tick_duration_s, + ci_cmd_with_delay, + run_till_end, + ): + """Run a test + + :param always_validation_sequence_set: Validation functions that should + hold on every tick + :param eventually_validation_sequence_set: Validation that should + eventually be true, before the test ends + :param test_timeout_s: The timeout for the test, if any eventually_validations + remain after the timeout, the test fails. + :param tick_duration_s: The simulation step duration + :param ci_cmd_with_delay: A list consisting of tuples with a duration and CI command, e.g. + [ + (time, command, team), + (time, command, team), + ... + ] + :param run_till_end: If true, test runs till the end even if eventually validation passes + If false, test stops once eventually validation passes and fails if time out + """ + time_elapsed_s = 0 + + eventually_validation_failure_msg = "Test Timed Out" + + while time_elapsed_s < test_timeout_s: + # get time before we execute the loop + processing_start_time = time.time() + + # Check for new CI commands at this time step + for delay, cmd, team in ci_cmd_with_delay: + # If delay matches time + if delay <= time_elapsed_s: + # send command + self.gamecontroller.send_gc_command(gc_command=cmd, team=team) + # remove command from the list + ci_cmd_with_delay.remove((delay, cmd, team)) + + tick = SimulatorTick(milliseconds=tick_duration_s * MILLISECONDS_PER_SECOND) + self.simulator_proto_unix_io.send_proto(SimulatorTick, tick) + time_elapsed_s += tick_duration_s + + while True: + try: + world = self.world_buffer.get( + block=True, timeout=WORLD_BUFFER_TIMEOUT, return_cached=False + ) + + # We block until the timeout for the new primitives from AI. if not found still, + # the SSL Wrapper packet is resent in a loop until we actually get a primitive set from AI + # Otherwise, if the AI misses the first SSL Wrapper packet and doesn't start + # the simulated test will continue to tick forward, causes syncing issues with the AI + self.primitive_set_buffer.get( + block=True, timeout=WORLD_BUFFER_TIMEOUT, return_cached=False + ) + + break + except queue.Empty: + # If we timeout, that means full_system missed the last + # wrapper and robot status, lets resend it. + logger.warning("Fullsystem missed last wrapper, resending ...") + + ssl_wrapper = self.ssl_wrapper_buffer.get(block=False) + robot_status = self.robot_status_buffer.get(block=False) + + self.blue_full_system_proto_unix_io.send_proto( + SSL_WrapperPacket, ssl_wrapper + ) + self.blue_full_system_proto_unix_io.send_proto( + RobotStatus, robot_status + ) + + # get the time difference after we get the primitive (after any blocking that happened) + processing_time = time.time() - processing_start_time + + # if the time we have blocked is less than a tick, sleep for the remaining time (for Thunderscope only) + if self.thunderscope and tick_duration_s > processing_time: + time.sleep(tick_duration_s - processing_time) + + # Validate + ( + eventually_validation_proto_set, + always_validation_proto_set, + ) = validation.run_validation_sequence_sets( + world, + eventually_validation_sequence_set, + always_validation_sequence_set, + ) + + # Set the test name + eventually_validation_proto_set.test_name = self.test_name + always_validation_proto_set.test_name = self.test_name + + # Send out the validation proto to the full system + # for visualization and logging for replays. + if self.is_yellow_friendly: + self.yellow_full_system_proto_unix_io.send_proto( + ValidationProtoSet, eventually_validation_proto_set + ) + self.yellow_full_system_proto_unix_io.send_proto( + ValidationProtoSet, always_validation_proto_set + ) + else: + self.blue_full_system_proto_unix_io.send_proto( + ValidationProtoSet, eventually_validation_proto_set + ) + self.blue_full_system_proto_unix_io.send_proto( + ValidationProtoSet, always_validation_proto_set + ) + + # Check that all always validations are always valid + validation.check_validation(always_validation_proto_set) + + if not run_till_end: + try: + # Check that all eventually validations are eventually valid + validation.check_validation(eventually_validation_proto_set) + self.__stopper() + return + except AssertionError as e: + eventually_validation_failure_msg = str(e) + + if not run_till_end: + raise AssertionError(eventually_validation_failure_msg) + + # Check that all eventually validations are eventually valid + validation.check_validation(eventually_validation_proto_set) + + self.__stopper() + + @override + def run_test( + self, + always_validation_sequence_set, + eventually_validation_sequence_set, + test_timeout_s=3, + tick_duration_s=0.0166, # Default to 60hz + index=0, + ci_cmd_with_delay=[], + run_till_end=True, + **kwargs, + ): + """Helper function to run a test, with thunderscope if enabled + + :param always_validation_sequence_set: validation that should always be true + :param eventually_validation_sequence_set: validation that should eventually be true + :param test_timeout_s: how long the test should run before timing out + :param tick_duration_s: length of a tick + :param index: index of the current test. default is 0 (invariant test) + values can be passed in during aggregate testing for different timeout durations + :param ci_cmd_with_delay: A list consisting of tuples with a duration and CI command, e.g. + [ + (time, command, team), + (time, command, team), + ... + ] + :param run_till_end: If true, test runs till the end even if eventually validation passes + If false, test stops once eventually validation passes and fails if time out + """ + test_timeout_duration = ( + test_timeout_s[index] if type(test_timeout_s) == list else test_timeout_s + ) + + # If thunderscope is enabled, run the test in a thread and show + # thunderscope on this thread. The excepthook is setup to catch + # any test failures and propagate them to the main thread + if self.thunderscope: + run_sim_thread = threading.Thread( + target=self.runner, + daemon=True, + args=[ + always_validation_sequence_set, + eventually_validation_sequence_set, + test_timeout_duration, + tick_duration_s, + ci_cmd_with_delay, + run_till_end, + ], + ) + run_sim_thread.start() + self.thunderscope.show() + run_sim_thread.join() + + if self.last_exception: + pytest.fail(str(self.last_exception)) + + # If thunderscope is disabled, just run the test + else: + self.runner( + always_validation_sequence_set, + eventually_validation_sequence_set, + test_timeout_duration, + tick_duration_s, + ci_cmd_with_delay=ci_cmd_with_delay, + run_till_end=run_till_end, + ) + + +class InvariantTestRunner(SimulatedTestRunner): + """Runs a simulated test only once with a given parameter + + Test passes or fails based on the outcome of this test + """ + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + @override + def run_test( + self, + setup=(lambda x: None), + params=[0], + inv_always_validation_sequence_set=[[]], + inv_eventually_validation_sequence_set=[[]], + **kwargs, + ): + """Run an invariant test + + :param setup: Function that sets up the World state and the gamecontroller before running the test + :param params: List of parameters for each iteration of the test + (this method only uses the first element) + :param inv_always_validation_sequence_set: Validation functions for invariant testing + that should hold on every tick + :param inv_eventually_validation_sequence_set: Validation functions for invariant testing + that should eventually be true, before the test ends + """ + threading.excepthook = self.excepthook + + super().sync_setup(setup, params[0]) + + super().run_test( + inv_always_validation_sequence_set, + inv_eventually_validation_sequence_set, + **kwargs, + ) + + +class AggregateTestRunner(SimulatedTestRunner): + """Runs a simulated test multiple times with different given parameters + + Result of the test is determined by comparing the number of + passing iterations to a predetermined acceptable threshold + """ + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + @override + def run_test( + self, + setup=(lambda arg: None), + params=[], + ag_always_validation_sequence_set=[[]], + ag_eventually_validation_sequence_set=[[]], + **kwargs, + ): + """Run an aggregate test + + :param setup: Function that sets up the World state and the gamecontroller before running the test + :param params: List of parameters for each iteration of the test + :param ag_always_validation_sequence_set: Validation functions for aggregate testing + that should hold on every tick + :param ag_eventually_validation_sequence_set: Validation functions for aggregate testing + that should eventually be true, before the test end + """ + threading.excepthook = self.excepthook + + failed_tests = 0 + + # Runs the test once for each given parameter + # Catches Assertion Error thrown by failing test and increments counter + # Calculates overall results and prints them + for x in range(len(params)): + super().sync_setup(setup, params[x]) + + try: + super().run_test( + ag_always_validation_sequence_set, + ag_eventually_validation_sequence_set, + **kwargs, + ) + except AssertionError: + failed_tests += 1 + + # TODO (#2856) Fix validation and results output + + logger.info(f"{failed_tests} test failed") + + assert failed_tests == 0 diff --git a/src/software/gameplay_tests/tbots_test_runner.py b/src/software/gameplay_tests/tbots_test_runner.py new file mode 100644 index 0000000000..a24bf8c137 --- /dev/null +++ b/src/software/gameplay_tests/tbots_test_runner.py @@ -0,0 +1,158 @@ +from proto.import_all_protos import * +from software.thunderscope.thread_safe_buffer import ThreadSafeBuffer +from abc import abstractmethod +from typing import Any + + +class TbotsTestRunner: + """An abstract class that represents a test runner""" + + def __init__( + self, + test_name, + thunderscope, + blue_full_system_proto_unix_io, + yellow_full_system_proto_unix_io, + gamecontroller, + is_yellow_friendly=False, + ): + """Initialize the TestRunner. + + :param test_name: The name of the test to run + :param thunderscope: The Thunderscope to use, None if not used + :param blue_full_system_proto_unix_io: The blue full system proto unix io to use + :param yellow_full_system_proto_unix_io: The yellow full system proto unix io to use + :param gamecontroller: The gamecontroller context managed instance + :param: is_yellow_friendly: if yellow is the friendly team + """ + self.test_name = test_name + self.thunderscope = thunderscope + self.blue_full_system_proto_unix_io = blue_full_system_proto_unix_io + self.yellow_full_system_proto_unix_io = yellow_full_system_proto_unix_io + self.gamecontroller = gamecontroller + self.is_yellow_friendly = is_yellow_friendly + self.world_buffer = ThreadSafeBuffer(buffer_size=20, protobuf_type=World) + self.primitive_set_buffer = ThreadSafeBuffer( + buffer_size=1, protobuf_type=PrimitiveSet + ) + self.last_exception = None + + self.ssl_wrapper_buffer = ThreadSafeBuffer( + buffer_size=1, protobuf_type=SSL_WrapperPacket + ) + self.robot_status_buffer = ThreadSafeBuffer( + buffer_size=1, protobuf_type=RobotStatus + ) + + self.blue_full_system_proto_unix_io.register_observer( + SSL_WrapperPacket, self.ssl_wrapper_buffer + ) + self.blue_full_system_proto_unix_io.register_observer( + RobotStatus, self.robot_status_buffer + ) + if self.is_yellow_friendly: + self.yellow_full_system_proto_unix_io.register_observer( + World, self.world_buffer + ) + self.yellow_full_system_proto_unix_io.register_observer( + PrimitiveSet, self.primitive_set_buffer + ) + # Only validate on the blue worlds + else: + self.blue_full_system_proto_unix_io.register_observer( + World, self.world_buffer + ) + self.blue_full_system_proto_unix_io.register_observer( + PrimitiveSet, self.primitive_set_buffer + ) + + def send_gamecontroller_command( + self, + gc_command: proto.ssl_gc_state_pb2.Command, + team: proto.ssl_gc_common_pb2.Team, + final_ball_placement_point=None, + ): + """Sends a gamecontroller command that is to be broadcasted to the given team + + :param gc_command: the gamecontroller command + :param is_friendly: whether the command should be sent to the friendly team + :param final_ball_placement_point: where to place the ball in ball placement + """ + self.gamecontroller.send_gc_command( + gc_command=gc_command, + team=team, + final_ball_placement_point=final_ball_placement_point, + ) + + def set_tactics( + self, + blue_tactics: dict[int, Any] | None = {}, + yellow_tactics: dict[int, Any] | None = {}, + ): + """Overrides AI tactics for all robots on each team. + By default, assigns no tactic for all robots whose id is not specified. + Pass in a None value for a team's tactics to not send tactics override. + + :param blue_tactics: None or dict of robot_id -> tactic for blue team + :param yellow_tactics: None or dict of robot_id -> tactic for yellow team + """ + if blue_tactics is not None: + blue_params = self._create_assigned_tactic_params(blue_tactics) + self.blue_full_system_proto_unix_io.send_proto( + AssignedTacticPlayControlParams, blue_params + ) + + if yellow_tactics is not None: + yellow_params = self._create_assigned_tactic_params(yellow_tactics) + self.yellow_full_system_proto_unix_io.send_proto( + AssignedTacticPlayControlParams, yellow_params + ) + + def set_plays(self, blue_play: PlayName, yellow_play: PlayName): + """Overrides current AI play for both teams + + :param blue_play: the play name for the blue team to use + :param yellow_play: the play name for the yellow team to use + """ + self.blue_full_system_proto_unix_io.send_proto(Play, Play(name=blue_play)) + self.yellow_full_system_proto_unix_io.send_proto(Play, Play(name=yellow_play)) + + def _create_assigned_tactic_params(self, tactics: dict[int, Any]): + """Converts dict of tactics to AssignedTacticPlayControlParams message + + :param tactics: dict of robot_id -> tactic + """ + params = AssignedTacticPlayControlParams() + + # Checks which oneof field in Tactic to assign the specified tactic to + for robot_id, specific_tactic in tactics.items(): + tactic = params.assigned_tactics[robot_id] + for field in tactic.DESCRIPTOR.oneofs_by_name["tactic"].fields: + if field.message_type == specific_tactic.DESCRIPTOR: + getattr(tactic, field.name).CopyFrom(specific_tactic) + break + + return params + + @abstractmethod + def set_world_state(self, worldstate: WorldState): + """Sets the worldstate for the given team + + :param worldstate: the worldstate proto to use + """ + raise NotImplementedError("abstract class method called set_world_state") + + @abstractmethod + def run_test( + self, + always_validation_sequence_set=[[]], + eventually_validation_sequence_set=[[]], + test_timeout_s=3, + ): + """Begins validating a test based on incoming world protos + + :param always_validation_sequence_set: validation set that must always be true + :param eventually_validation_sequence_set: validation set that must eventually be true + :param test_timeout_s: how long the test will run + """ + raise NotImplementedError("abstract method run_test called from base class") diff --git a/src/software/gameplay_tests/util.py b/src/software/gameplay_tests/util.py new file mode 100644 index 0000000000..b35fb44c07 --- /dev/null +++ b/src/software/gameplay_tests/util.py @@ -0,0 +1,108 @@ +import argparse +import sys + +import pytest + + +def load_command_line_arguments(allow_unrecognized: bool = False): + """Load in command-line arguments using argparse + + NOTE: Pytest has its own built in argument parser (conftest.py, pytest_addoption) + but it doesn't seem to play nicely with bazel. We just use argparse instead. + + :param allow_unrecognized: if true, does not raise an error for unrecognized arguments + """ + + # TODO: add field test specific flags + + parser = argparse.ArgumentParser(description="Run simulated pytests") + parser.add_argument( + "--enable_thunderscope", action="store_true", help="enable thunderscope" + ) + parser.add_argument( + "--aggregate", action="store_true", default=False, help="Run aggregate test" + ) + parser.add_argument( + "--simulator_runtime_dir", + type=str, + help="simulator runtime directory", + default="/tmp/tbots", + ) + parser.add_argument( + "--blue_full_system_runtime_dir", + type=str, + help="blue full_system runtime directory", + default="/tmp/tbots/blue", + ) + parser.add_argument( + "--yellow_full_system_runtime_dir", + type=str, + help="yellow full_system runtime directory", + default="/tmp/tbots/yellow", + ) + parser.add_argument( + "--layout", + action="store", + help="Which layout to run, if not specified the last layout will run", + ) + parser.add_argument( + "--debug_blue_full_system", + action="store_true", + default=False, + help="Debug blue full_system", + ) + parser.add_argument( + "--debug_yellow_full_system", + action="store_true", + default=False, + help="Debug yellow full_system", + ) + parser.add_argument( + "--debug_simulator", + action="store_true", + default=False, + help="Debug the simulator", + ) + parser.add_argument( + "--visualization_buffer_size", + action="store", + type=int, + default=5, + help="How many packets to buffer while rendering", + ) + parser.add_argument( + "--show_gamecontroller_logs", + action="store_true", + default=False, + help="Show gamecontroller logs", + ) + parser.add_argument( + "--test_filter", + action="store", + default="", + help="The test filter, if not specified all tests will run. " + + "See https://docs.pytest.org/en/latest/how-to/usage.html#specifying-tests-selecting-tests", + ) + parser.add_argument( + "--enable_realism", + action="store_true", + default=False, + help="Use realism in the simulator", + ) + return parser.parse_known_args()[0] if allow_unrecognized else parser.parse_args() + + +def pytest_main(file): + """Runs the pytest file + + :param file: The test file to run + """ + args = load_command_line_arguments(allow_unrecognized=True) + + # Run the test, -s disables all capturing at -vv increases verbosity + # -W ignore::DeprecationWarning ignores deprecation warnings that spam the output + sys.exit( + pytest.main( + ["-svv", "-W ignore::DeprecationWarning", "-k", args.test_filter, file] + ) + ) From f67179c1b2b900c34c9ddcc603e4eb7ee34bc5f5 Mon Sep 17 00:00:00 2001 From: Eric Xiao Date: Tue, 26 May 2026 16:07:57 -0700 Subject: [PATCH 02/18] Move validations to gameplay_tests package --- src/software/ai/hl/stp/play/BUILD | 6 +++--- src/software/ai/hl/stp/play/ball_placement/BUILD | 2 +- .../ball_placement/ball_placement_play_test.py | 4 ++-- src/software/ai/hl/stp/play/crease_defense/BUILD | 2 +- .../crease_defense/crease_defense_play_test.py | 6 +++--- src/software/ai/hl/stp/play/defense/BUILD | 2 +- .../ai/hl/stp/play/defense/defense_play_test.py | 4 ++-- .../ai/hl/stp/play/enemy_ball_placement/BUILD | 2 +- .../enemy_ball_placement_play_test.py | 2 +- .../ai/hl/stp/play/enemy_free_kick/BUILD | 2 +- .../enemy_free_kick/enemy_free_kick_play_test.py | 8 ++++---- src/software/ai/hl/stp/play/example/BUILD | 2 +- .../ai/hl/stp/play/example/example_play_test.py | 2 +- src/software/ai/hl/stp/play/free_kick/BUILD | 2 +- .../hl/stp/play/free_kick/free_kick_play_test.py | 6 +++--- src/software/ai/hl/stp/play/halt_play/BUILD | 2 +- .../ai/hl/stp/play/halt_play/halt_play_test.py | 2 +- src/software/ai/hl/stp/play/kickoff_enemy/BUILD | 2 +- .../kickoff_enemy/kickoff_enemy_play_test.py | 6 +++--- .../ai/hl/stp/play/kickoff_friendly/BUILD | 2 +- .../kickoff_friendly_play_test.py | 8 ++++---- src/software/ai/hl/stp/play/kickoff_play_test.py | 6 +++--- src/software/ai/hl/stp/play/offense/BUILD | 2 +- .../ai/hl/stp/play/offense/offense_play_test.py | 8 ++++---- src/software/ai/hl/stp/play/passing_sim_test.py | 8 ++++---- .../ai/hl/stp/play/penalty_kick_enemy/BUILD | 2 +- .../penalty_kick_enemy_play_test.py | 6 +++--- src/software/ai/hl/stp/play/shoot_or_chip/BUILD | 2 +- src/software/ai/hl/stp/play/shoot_or_pass/BUILD | 2 +- .../shoot_or_pass/shoot_or_pass_play_test.py | 2 +- src/software/ai/hl/stp/play/stop_play_test.py | 6 +++--- src/software/ai/hl/stp/tactic/attacker/BUILD | 2 +- .../stp/tactic/attacker/attacker_tactic_test.py | 10 +++++----- src/software/ai/hl/stp/tactic/chip/BUILD | 2 +- .../ai/hl/stp/tactic/chip/chip_tactic_test.py | 4 ++-- .../ai/hl/stp/tactic/crease_defender/BUILD | 2 +- .../crease_defender_tactic_test.py | 10 +++++----- src/software/ai/hl/stp/tactic/dribble/BUILD | 2 +- .../hl/stp/tactic/dribble/dribble_tactic_test.py | 10 +++++----- src/software/ai/hl/stp/tactic/goalie/BUILD | 2 +- .../hl/stp/tactic/goalie/goalie_tactic_test.py | 14 +++++++------- src/software/ai/hl/stp/tactic/halt/BUILD | 2 +- .../ai/hl/stp/tactic/halt/halt_tactic_test.py | 4 ++-- src/software/ai/hl/stp/tactic/kick/BUILD | 2 +- .../ai/hl/stp/tactic/kick/kick_tactic_test.py | 2 +- src/software/ai/hl/stp/tactic/move/BUILD | 2 +- .../ai/hl/stp/tactic/move/move_tactic_test.py | 12 ++++++------ .../ai/hl/stp/tactic/pass_defender/BUILD | 2 +- .../pass_defender/pass_defender_tactic_test.py | 14 +++++++------- src/software/ai/hl/stp/tactic/penalty_kick/BUILD | 2 +- .../penalty_kick/penalty_kick_tactic_test.py | 6 +++--- src/software/ai/hl/stp/tactic/pivot_kick/BUILD | 2 +- .../tactic/pivot_kick/pivot_kick_tactic_test.py | 2 +- src/software/ai/hl/stp/tactic/receiver/BUILD | 2 +- .../stp/tactic/receiver/receiver_tactic_test.py | 6 +++--- src/software/ai/navigator/trajectory/BUILD | 2 +- .../navigator/trajectory/simulated_hrvo_test.py | 4 ++-- src/software/field_tests/BUILD | 8 ++++---- src/software/field_tests/field_test_fixture.py | 2 +- src/software/field_tests/passing_field_test.py | 2 +- .../gameplay_tests/simulated_test_runner.py | 2 +- .../validation/BUILD | 0 .../validation/__init__.py | 0 .../validation/avoid_collisions.py | 2 +- .../validation/ball_enters_region.py | 2 +- .../validation/ball_is_off_ground.py | 2 +- .../validation/ball_kicked_in_direction.py | 2 +- .../validation/ball_moves_in_direction.py | 2 +- .../validation/ball_speed_threshold.py | 4 ++-- .../validation/ball_stops_in_region.py | 2 +- .../validation/delay_validation.py | 2 +- .../validation/duration_validation.py | 2 +- .../validation/excessive_dribbling.py | 2 +- .../validation/friendly_has_ball_possession.py | 2 +- .../validation/friendly_receives_ball_slow.py | 4 ++-- .../validation/friendly_team_scored.py | 2 +- .../validation/or_validation.py | 2 +- .../validation/robot_at_angular_velocity.py | 2 +- .../validation/robot_at_orientation.py | 2 +- .../validation/robot_at_position.py | 2 +- .../validation/robot_enters_placement_region.py | 2 +- .../validation/robot_enters_region.py | 2 +- .../validation/robot_enters_region_and_stops.py | 4 ++-- .../validation/robot_received_ball.py | 2 +- .../validation/robot_speed_threshold.py | 4 ++-- .../validation/speed_threshold_helpers.py | 0 .../validation/validation.py | 0 src/software/sensor_fusion/filter/BUILD | 2 +- src/software/simulated_tests/BUILD | 6 +++--- .../simulated_tests/simulated_test_ball_model.py | 16 ++++++++-------- .../simulated_tests/simulated_test_fixture.py | 2 +- 91 files changed, 167 insertions(+), 167 deletions(-) rename src/software/{simulated_tests => gameplay_tests}/validation/BUILD (100%) rename src/software/{simulated_tests => gameplay_tests}/validation/__init__.py (100%) rename src/software/{simulated_tests => gameplay_tests}/validation/avoid_collisions.py (99%) rename src/software/{simulated_tests => gameplay_tests}/validation/ball_enters_region.py (96%) rename src/software/{simulated_tests => gameplay_tests}/validation/ball_is_off_ground.py (98%) rename src/software/{simulated_tests => gameplay_tests}/validation/ball_kicked_in_direction.py (97%) rename src/software/{simulated_tests => gameplay_tests}/validation/ball_moves_in_direction.py (98%) rename src/software/{simulated_tests => gameplay_tests}/validation/ball_speed_threshold.py (94%) rename src/software/{simulated_tests => gameplay_tests}/validation/ball_stops_in_region.py (96%) rename src/software/{simulated_tests => gameplay_tests}/validation/delay_validation.py (96%) rename src/software/{simulated_tests => gameplay_tests}/validation/duration_validation.py (96%) rename src/software/{simulated_tests => gameplay_tests}/validation/excessive_dribbling.py (98%) rename src/software/{simulated_tests => gameplay_tests}/validation/friendly_has_ball_possession.py (97%) rename src/software/{simulated_tests => gameplay_tests}/validation/friendly_receives_ball_slow.py (93%) rename src/software/{simulated_tests => gameplay_tests}/validation/friendly_team_scored.py (96%) rename src/software/{simulated_tests => gameplay_tests}/validation/or_validation.py (96%) rename src/software/{simulated_tests => gameplay_tests}/validation/robot_at_angular_velocity.py (97%) rename src/software/{simulated_tests => gameplay_tests}/validation/robot_at_orientation.py (97%) rename src/software/{simulated_tests => gameplay_tests}/validation/robot_at_position.py (97%) rename src/software/{simulated_tests => gameplay_tests}/validation/robot_enters_placement_region.py (97%) rename src/software/{simulated_tests => gameplay_tests}/validation/robot_enters_region.py (97%) rename src/software/{simulated_tests => gameplay_tests}/validation/robot_enters_region_and_stops.py (96%) rename src/software/{simulated_tests => gameplay_tests}/validation/robot_received_ball.py (97%) rename src/software/{simulated_tests => gameplay_tests}/validation/robot_speed_threshold.py (95%) rename src/software/{simulated_tests => gameplay_tests}/validation/speed_threshold_helpers.py (100%) rename src/software/{simulated_tests => gameplay_tests}/validation/validation.py (100%) diff --git a/src/software/ai/hl/stp/play/BUILD b/src/software/ai/hl/stp/play/BUILD index a74371ace5..65c2424512 100644 --- a/src/software/ai/hl/stp/play/BUILD +++ b/src/software/ai/hl/stp/play/BUILD @@ -82,7 +82,7 @@ py_test( ], deps = [ "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) @@ -100,7 +100,7 @@ py_test( ], deps = [ "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) @@ -156,7 +156,7 @@ py_test( "//proto:software_py_proto", "//proto:tbots_py_proto", "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) diff --git a/src/software/ai/hl/stp/play/ball_placement/BUILD b/src/software/ai/hl/stp/play/ball_placement/BUILD index 6621cec3d4..1551805e1b 100644 --- a/src/software/ai/hl/stp/play/ball_placement/BUILD +++ b/src/software/ai/hl/stp/play/ball_placement/BUILD @@ -40,7 +40,7 @@ py_test( tags = ["exclusive"], deps = [ "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) diff --git a/src/software/ai/hl/stp/play/ball_placement/ball_placement_play_test.py b/src/software/ai/hl/stp/play/ball_placement/ball_placement_play_test.py index 77e4e196ab..3e03c3d2cf 100644 --- a/src/software/ai/hl/stp/play/ball_placement/ball_placement_play_test.py +++ b/src/software/ai/hl/stp/play/ball_placement/ball_placement_play_test.py @@ -5,11 +5,11 @@ from proto.import_all_protos import * from proto.ssl_gc_common_pb2 import Team from proto.message_translation.tbots_protobuf import create_world_state -from software.simulated_tests.validation.ball_enters_region import ( +from software.gameplay_tests.validation.ball_enters_region import ( BallAlwaysStaysInRegion, BallEventuallyEntersRegion, ) -from software.simulated_tests.validation.robot_enters_region import ( +from software.gameplay_tests.validation.robot_enters_region import ( RobotEventuallyExitsRegion, ) from software.simulated_tests.simulated_test_fixture import ( diff --git a/src/software/ai/hl/stp/play/crease_defense/BUILD b/src/software/ai/hl/stp/play/crease_defense/BUILD index ca6980db81..5b62e4d79c 100644 --- a/src/software/ai/hl/stp/play/crease_defense/BUILD +++ b/src/software/ai/hl/stp/play/crease_defense/BUILD @@ -39,7 +39,7 @@ py_test( ], deps = [ "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) diff --git a/src/software/ai/hl/stp/play/crease_defense/crease_defense_play_test.py b/src/software/ai/hl/stp/play/crease_defense/crease_defense_play_test.py index 10dd36212d..c23783e599 100644 --- a/src/software/ai/hl/stp/play/crease_defense/crease_defense_play_test.py +++ b/src/software/ai/hl/stp/play/crease_defense/crease_defense_play_test.py @@ -6,13 +6,13 @@ from software.simulated_tests.simulated_test_fixture import ( pytest_main, ) -from software.simulated_tests.validation.robot_speed_threshold import ( +from software.gameplay_tests.validation.robot_speed_threshold import ( RobotSpeedEventuallyBelowThreshold, ) -from software.simulated_tests.validation.robot_enters_region import ( +from software.gameplay_tests.validation.robot_enters_region import ( NumberOfRobotsEventuallyEntersRegion, ) -from software.simulated_tests.validation.delay_validation import DelayValidation +from software.gameplay_tests.validation.delay_validation import DelayValidation def test_crease_defense_play(simulated_test_runner): diff --git a/src/software/ai/hl/stp/play/defense/BUILD b/src/software/ai/hl/stp/play/defense/BUILD index 2f2d8de10e..6c8e761e81 100644 --- a/src/software/ai/hl/stp/play/defense/BUILD +++ b/src/software/ai/hl/stp/play/defense/BUILD @@ -42,7 +42,7 @@ py_test( ], deps = [ "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) diff --git a/src/software/ai/hl/stp/play/defense/defense_play_test.py b/src/software/ai/hl/stp/play/defense/defense_play_test.py index 07e29ed85b..32203c6cd1 100644 --- a/src/software/ai/hl/stp/play/defense/defense_play_test.py +++ b/src/software/ai/hl/stp/play/defense/defense_play_test.py @@ -2,8 +2,8 @@ import software.python_bindings as tbots_cpp from proto.play_pb2 import PlayName -from software.simulated_tests.validation.ball_enters_region import * -from software.simulated_tests.validation.friendly_has_ball_possession import ( +from software.gameplay_tests.validation.ball_enters_region import * +from software.gameplay_tests.validation.friendly_has_ball_possession import ( FriendlyEventuallyHasBallPossession, ) from proto.message_translation.tbots_protobuf import create_world_state diff --git a/src/software/ai/hl/stp/play/enemy_ball_placement/BUILD b/src/software/ai/hl/stp/play/enemy_ball_placement/BUILD index de72dcf77f..3ca1b7c9ec 100644 --- a/src/software/ai/hl/stp/play/enemy_ball_placement/BUILD +++ b/src/software/ai/hl/stp/play/enemy_ball_placement/BUILD @@ -31,7 +31,7 @@ py_test( tags = ["exclusive"], deps = [ "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) diff --git a/src/software/ai/hl/stp/play/enemy_ball_placement/enemy_ball_placement_play_test.py b/src/software/ai/hl/stp/play/enemy_ball_placement/enemy_ball_placement_play_test.py index 686f71d1a5..6f0262acbb 100644 --- a/src/software/ai/hl/stp/play/enemy_ball_placement/enemy_ball_placement_play_test.py +++ b/src/software/ai/hl/stp/play/enemy_ball_placement/enemy_ball_placement_play_test.py @@ -2,7 +2,7 @@ import software.python_bindings as tbots_cpp from proto.play_pb2 import PlayName -from software.simulated_tests.validation.robot_enters_placement_region import * +from software.gameplay_tests.validation.robot_enters_placement_region import * from software.simulated_tests.simulated_test_fixture import ( pytest_main, ) diff --git a/src/software/ai/hl/stp/play/enemy_free_kick/BUILD b/src/software/ai/hl/stp/play/enemy_free_kick/BUILD index ca05d2fd7f..f0be4df238 100644 --- a/src/software/ai/hl/stp/play/enemy_free_kick/BUILD +++ b/src/software/ai/hl/stp/play/enemy_free_kick/BUILD @@ -45,7 +45,7 @@ py_test( ], deps = [ "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) diff --git a/src/software/ai/hl/stp/play/enemy_free_kick/enemy_free_kick_play_test.py b/src/software/ai/hl/stp/play/enemy_free_kick/enemy_free_kick_play_test.py index 2ee008c340..d6666e74f3 100644 --- a/src/software/ai/hl/stp/play/enemy_free_kick/enemy_free_kick_play_test.py +++ b/src/software/ai/hl/stp/play/enemy_free_kick/enemy_free_kick_play_test.py @@ -3,11 +3,11 @@ import software.python_bindings as tbots_cpp from proto.play_pb2 import PlayName -from software.simulated_tests.validation.or_validation import OrValidation +from software.gameplay_tests.validation.or_validation import OrValidation -from software.simulated_tests.validation.friendly_team_scored import * -from software.simulated_tests.validation.ball_enters_region import * -from software.simulated_tests.validation.robot_enters_region import ( +from software.gameplay_tests.validation.friendly_team_scored import * +from software.gameplay_tests.validation.ball_enters_region import * +from software.gameplay_tests.validation.robot_enters_region import ( RobotEventuallyEntersRegion, RobotNeverEntersRegion, ) diff --git a/src/software/ai/hl/stp/play/example/BUILD b/src/software/ai/hl/stp/play/example/BUILD index 1b1f1de048..85973334fa 100644 --- a/src/software/ai/hl/stp/play/example/BUILD +++ b/src/software/ai/hl/stp/play/example/BUILD @@ -41,7 +41,7 @@ py_test( ], deps = [ "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) diff --git a/src/software/ai/hl/stp/play/example/example_play_test.py b/src/software/ai/hl/stp/play/example/example_play_test.py index 9fbede9cf6..7b2003881d 100644 --- a/src/software/ai/hl/stp/play/example/example_play_test.py +++ b/src/software/ai/hl/stp/play/example/example_play_test.py @@ -1,5 +1,5 @@ import software.python_bindings as tbots_cpp -from software.simulated_tests.validation.robot_enters_region import ( +from software.gameplay_tests.validation.robot_enters_region import ( NumberOfRobotsEventuallyExitsRegion, NumberOfRobotsEventuallyEntersRegion, ) diff --git a/src/software/ai/hl/stp/play/free_kick/BUILD b/src/software/ai/hl/stp/play/free_kick/BUILD index bf0f2ee4df..3d54957d92 100644 --- a/src/software/ai/hl/stp/play/free_kick/BUILD +++ b/src/software/ai/hl/stp/play/free_kick/BUILD @@ -40,7 +40,7 @@ py_test( tags = ["exclusive"], deps = [ "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) diff --git a/src/software/ai/hl/stp/play/free_kick/free_kick_play_test.py b/src/software/ai/hl/stp/play/free_kick/free_kick_play_test.py index 264d6ff9f3..6fc077b0cc 100644 --- a/src/software/ai/hl/stp/play/free_kick/free_kick_play_test.py +++ b/src/software/ai/hl/stp/play/free_kick/free_kick_play_test.py @@ -7,13 +7,13 @@ from proto.ssl_gc_common_pb2 import Team from proto.message_translation.tbots_protobuf import create_world_state -from software.simulated_tests.validation.friendly_team_scored import ( +from software.gameplay_tests.validation.friendly_team_scored import ( FriendlyTeamEventuallyScored, ) -from software.simulated_tests.validation.robot_enters_region import ( +from software.gameplay_tests.validation.robot_enters_region import ( RobotEventuallyEntersRegion, ) -from software.simulated_tests.validation.ball_kicked_in_direction import ( +from software.gameplay_tests.validation.ball_kicked_in_direction import ( BallEventuallyKickedInDirection, ) from software.simulated_tests.simulated_test_fixture import ( diff --git a/src/software/ai/hl/stp/play/halt_play/BUILD b/src/software/ai/hl/stp/play/halt_play/BUILD index f67983bfc4..f09a9b1eb9 100644 --- a/src/software/ai/hl/stp/play/halt_play/BUILD +++ b/src/software/ai/hl/stp/play/halt_play/BUILD @@ -43,7 +43,7 @@ py_test( ], deps = [ "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) diff --git a/src/software/ai/hl/stp/play/halt_play/halt_play_test.py b/src/software/ai/hl/stp/play/halt_play/halt_play_test.py index 1d7412c750..fb42822fd8 100644 --- a/src/software/ai/hl/stp/play/halt_play/halt_play_test.py +++ b/src/software/ai/hl/stp/play/halt_play/halt_play_test.py @@ -1,5 +1,5 @@ import software.python_bindings as tbots_cpp -from software.simulated_tests.validation.robot_speed_threshold import * +from software.gameplay_tests.validation.robot_speed_threshold import * from proto.message_translation.tbots_protobuf import create_world_state from proto.ssl_gc_common_pb2 import Team from software.simulated_tests.simulated_test_fixture import ( diff --git a/src/software/ai/hl/stp/play/kickoff_enemy/BUILD b/src/software/ai/hl/stp/play/kickoff_enemy/BUILD index 409b7ba865..ced9473a5f 100644 --- a/src/software/ai/hl/stp/play/kickoff_enemy/BUILD +++ b/src/software/ai/hl/stp/play/kickoff_enemy/BUILD @@ -32,7 +32,7 @@ py_test( tags = ["exclusive"], deps = [ "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) diff --git a/src/software/ai/hl/stp/play/kickoff_enemy/kickoff_enemy_play_test.py b/src/software/ai/hl/stp/play/kickoff_enemy/kickoff_enemy_play_test.py index ce8968de8f..2df9a51b5d 100644 --- a/src/software/ai/hl/stp/play/kickoff_enemy/kickoff_enemy_play_test.py +++ b/src/software/ai/hl/stp/play/kickoff_enemy/kickoff_enemy_play_test.py @@ -3,13 +3,13 @@ import software.python_bindings as tbots_cpp from proto.play_pb2 import PlayName -from software.simulated_tests.validation.robot_enters_region import ( +from software.gameplay_tests.validation.robot_enters_region import ( NumberOfRobotsEventuallyEntersRegion, NumberOfRobotsAlwaysStaysInRegion, RobotNeverEntersRegion, ) -from software.simulated_tests.validation.or_validation import OrValidation -from software.simulated_tests.validation.ball_enters_region import BallNeverEntersRegion +from software.gameplay_tests.validation.or_validation import OrValidation +from software.gameplay_tests.validation.ball_enters_region import BallNeverEntersRegion from proto.message_translation.tbots_protobuf import create_world_state from proto.import_all_protos import Command from proto.ssl_gc_common_pb2 import Team diff --git a/src/software/ai/hl/stp/play/kickoff_friendly/BUILD b/src/software/ai/hl/stp/play/kickoff_friendly/BUILD index 35325ce76a..a31fa94912 100644 --- a/src/software/ai/hl/stp/play/kickoff_friendly/BUILD +++ b/src/software/ai/hl/stp/play/kickoff_friendly/BUILD @@ -31,7 +31,7 @@ py_test( tags = ["exclusive"], deps = [ "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) diff --git a/src/software/ai/hl/stp/play/kickoff_friendly/kickoff_friendly_play_test.py b/src/software/ai/hl/stp/play/kickoff_friendly/kickoff_friendly_play_test.py index a7e33d5d34..51016b9901 100644 --- a/src/software/ai/hl/stp/play/kickoff_friendly/kickoff_friendly_play_test.py +++ b/src/software/ai/hl/stp/play/kickoff_friendly/kickoff_friendly_play_test.py @@ -3,17 +3,17 @@ import software.python_bindings as tbots_cpp from proto.play_pb2 import PlayName -from software.simulated_tests.validation.robot_enters_region import ( +from software.gameplay_tests.validation.robot_enters_region import ( NumberOfRobotsEventuallyEntersRegion, NumberOfRobotsAlwaysStaysInRegion, NumberOfRobotsNeverEntersRegion, RobotEventuallyEntersRegion, ) -from software.simulated_tests.validation.ball_kicked_in_direction import ( +from software.gameplay_tests.validation.ball_kicked_in_direction import ( BallEventuallyKickedInDirection, ) -from software.simulated_tests.validation.ball_enters_region import BallNeverEntersRegion -from software.simulated_tests.validation.or_validation import OrValidation +from software.gameplay_tests.validation.ball_enters_region import BallNeverEntersRegion +from software.gameplay_tests.validation.or_validation import OrValidation from proto.message_translation.tbots_protobuf import create_world_state from proto.ssl_gc_common_pb2 import Team from proto.import_all_protos import Command diff --git a/src/software/ai/hl/stp/play/kickoff_play_test.py b/src/software/ai/hl/stp/play/kickoff_play_test.py index f56f5eb8dd..2e3f87d0d1 100644 --- a/src/software/ai/hl/stp/play/kickoff_play_test.py +++ b/src/software/ai/hl/stp/play/kickoff_play_test.py @@ -2,15 +2,15 @@ import software.python_bindings as tbots_cpp from proto.play_pb2 import PlayName -from software.simulated_tests.validation.robot_enters_region import * -from software.simulated_tests.validation.ball_enters_region import * +from software.gameplay_tests.validation.robot_enters_region import * +from software.gameplay_tests.validation.ball_enters_region import * from proto.import_all_protos import * from proto.message_translation.tbots_protobuf import create_world_state from proto.ssl_gc_common_pb2 import Team from software.simulated_tests.simulated_test_fixture import ( pytest_main, ) -from software.simulated_tests.validation.or_validation import OrValidation +from software.gameplay_tests.validation.or_validation import OrValidation @pytest.mark.parametrize("is_friendly_test", [True, False]) diff --git a/src/software/ai/hl/stp/play/offense/BUILD b/src/software/ai/hl/stp/play/offense/BUILD index 930f5d13d6..a3c7a2145e 100644 --- a/src/software/ai/hl/stp/play/offense/BUILD +++ b/src/software/ai/hl/stp/play/offense/BUILD @@ -39,7 +39,7 @@ py_test( ], deps = [ "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) diff --git a/src/software/ai/hl/stp/play/offense/offense_play_test.py b/src/software/ai/hl/stp/play/offense/offense_play_test.py index 29f49b039a..2988abd37c 100644 --- a/src/software/ai/hl/stp/play/offense/offense_play_test.py +++ b/src/software/ai/hl/stp/play/offense/offense_play_test.py @@ -1,9 +1,9 @@ import software.python_bindings as tbots_cpp from proto.play_pb2 import PlayName -from software.simulated_tests.validation.friendly_team_scored import * -from software.simulated_tests.validation.ball_enters_region import * -from software.simulated_tests.validation.friendly_has_ball_possession import * -from software.simulated_tests.validation.excessive_dribbling import * +from software.gameplay_tests.validation.friendly_team_scored import * +from software.gameplay_tests.validation.ball_enters_region import * +from software.gameplay_tests.validation.friendly_has_ball_possession import * +from software.gameplay_tests.validation.excessive_dribbling import * from proto.message_translation.tbots_protobuf import create_world_state from proto.ssl_gc_common_pb2 import Team from software.simulated_tests.simulated_test_fixture import ( diff --git a/src/software/ai/hl/stp/play/passing_sim_test.py b/src/software/ai/hl/stp/play/passing_sim_test.py index bf915965fd..6a8693da31 100644 --- a/src/software/ai/hl/stp/play/passing_sim_test.py +++ b/src/software/ai/hl/stp/play/passing_sim_test.py @@ -5,16 +5,16 @@ pytest_main, ) from proto.message_translation.tbots_protobuf import create_world_state -from software.simulated_tests.validation.friendly_receives_ball_slow import ( +from software.gameplay_tests.validation.friendly_receives_ball_slow import ( FriendlyAlwaysReceivesBallSlow, ) -from software.simulated_tests.validation.friendly_has_ball_possession import ( +from software.gameplay_tests.validation.friendly_has_ball_possession import ( FriendlyEventuallyHasBallPossession, ) -from software.simulated_tests.validation.ball_moves_in_direction import ( +from software.gameplay_tests.validation.ball_moves_in_direction import ( BallMovesForwardInRegions, ) -from software.simulated_tests.validation.ball_enters_region import ( +from software.gameplay_tests.validation.ball_enters_region import ( BallEventuallyExitsRegion, BallEventuallyEntersRegion, ) diff --git a/src/software/ai/hl/stp/play/penalty_kick_enemy/BUILD b/src/software/ai/hl/stp/play/penalty_kick_enemy/BUILD index b83140a6e5..087121e786 100644 --- a/src/software/ai/hl/stp/play/penalty_kick_enemy/BUILD +++ b/src/software/ai/hl/stp/play/penalty_kick_enemy/BUILD @@ -40,7 +40,7 @@ py_test( tags = ["exclusive"], deps = [ "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) diff --git a/src/software/ai/hl/stp/play/penalty_kick_enemy/penalty_kick_enemy_play_test.py b/src/software/ai/hl/stp/play/penalty_kick_enemy/penalty_kick_enemy_play_test.py index 366518b3bb..af0127a5b8 100644 --- a/src/software/ai/hl/stp/play/penalty_kick_enemy/penalty_kick_enemy_play_test.py +++ b/src/software/ai/hl/stp/play/penalty_kick_enemy/penalty_kick_enemy_play_test.py @@ -4,13 +4,13 @@ from software.py_constants import ROBOT_MAX_RADIUS_METERS from proto.play_pb2 import PlayName -from software.simulated_tests.validation.robot_enters_region import ( +from software.gameplay_tests.validation.robot_enters_region import ( NumberOfRobotsEventuallyEntersRegion, ) -from software.simulated_tests.validation.robot_at_position import ( +from software.gameplay_tests.validation.robot_at_position import ( RobotEventuallyAtPosition, ) -from software.simulated_tests.validation.robot_at_orientation import ( +from software.gameplay_tests.validation.robot_at_orientation import ( RobotEventuallyAtOrientation, ) from proto.message_translation.tbots_protobuf import create_world_state diff --git a/src/software/ai/hl/stp/play/shoot_or_chip/BUILD b/src/software/ai/hl/stp/play/shoot_or_chip/BUILD index 2d74dd1993..02f4a51458 100644 --- a/src/software/ai/hl/stp/play/shoot_or_chip/BUILD +++ b/src/software/ai/hl/stp/play/shoot_or_chip/BUILD @@ -42,7 +42,7 @@ py_test( ], deps = [ "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) diff --git a/src/software/ai/hl/stp/play/shoot_or_pass/BUILD b/src/software/ai/hl/stp/play/shoot_or_pass/BUILD index bc366bd8a0..a153f99580 100644 --- a/src/software/ai/hl/stp/play/shoot_or_pass/BUILD +++ b/src/software/ai/hl/stp/play/shoot_or_pass/BUILD @@ -58,7 +58,7 @@ py_test( ], deps = [ "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) diff --git a/src/software/ai/hl/stp/play/shoot_or_pass/shoot_or_pass_play_test.py b/src/software/ai/hl/stp/play/shoot_or_pass/shoot_or_pass_play_test.py index 25bcd71c33..3696893c56 100644 --- a/src/software/ai/hl/stp/play/shoot_or_pass/shoot_or_pass_play_test.py +++ b/src/software/ai/hl/stp/play/shoot_or_pass/shoot_or_pass_play_test.py @@ -5,7 +5,7 @@ from proto.play_pb2 import PlayName from proto.ssl_gc_common_pb2 import Team from proto.message_translation.tbots_protobuf import create_world_state -from software.simulated_tests.validation.friendly_team_scored import ( +from software.gameplay_tests.validation.friendly_team_scored import ( FriendlyTeamEventuallyScored, ) from software.simulated_tests.simulated_test_fixture import pytest_main diff --git a/src/software/ai/hl/stp/play/stop_play_test.py b/src/software/ai/hl/stp/play/stop_play_test.py index 8735319ffe..2c7639b48f 100644 --- a/src/software/ai/hl/stp/play/stop_play_test.py +++ b/src/software/ai/hl/stp/play/stop_play_test.py @@ -5,13 +5,13 @@ from proto.play_pb2 import PlayName from proto.ssl_gc_common_pb2 import Team from proto.message_translation.tbots_protobuf import create_world_state -from software.simulated_tests.validation.robot_speed_threshold import ( +from software.gameplay_tests.validation.robot_speed_threshold import ( RobotSpeedAlwaysBelowThreshold, ) -from software.simulated_tests.validation.robot_enters_region import ( +from software.gameplay_tests.validation.robot_enters_region import ( RobotNeverEntersRegion, ) -from software.simulated_tests.validation.delay_validation import DelayValidation +from software.gameplay_tests.validation.delay_validation import DelayValidation from software.simulated_tests.simulated_test_fixture import pytest_main diff --git a/src/software/ai/hl/stp/tactic/attacker/BUILD b/src/software/ai/hl/stp/tactic/attacker/BUILD index 86634c632e..1c680eed06 100644 --- a/src/software/ai/hl/stp/tactic/attacker/BUILD +++ b/src/software/ai/hl/stp/tactic/attacker/BUILD @@ -41,7 +41,7 @@ py_test( tags = ["exclusive"], deps = [ "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) diff --git a/src/software/ai/hl/stp/tactic/attacker/attacker_tactic_test.py b/src/software/ai/hl/stp/tactic/attacker/attacker_tactic_test.py index df4a815277..24a372f369 100644 --- a/src/software/ai/hl/stp/tactic/attacker/attacker_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/attacker/attacker_tactic_test.py @@ -4,19 +4,19 @@ from proto.import_all_protos import AttackerTactic, Pass from proto.message_translation.tbots_protobuf import create_world_state -from software.simulated_tests.validation.ball_kicked_in_direction import ( +from software.gameplay_tests.validation.ball_kicked_in_direction import ( BallEventuallyKickedInDirection, ) -from software.simulated_tests.validation.excessive_dribbling import ( +from software.gameplay_tests.validation.excessive_dribbling import ( NeverExcessivelyDribbles, ) -from software.simulated_tests.validation.friendly_team_scored import ( +from software.gameplay_tests.validation.friendly_team_scored import ( FriendlyTeamEventuallyScored, ) -from software.simulated_tests.validation.robot_at_orientation import ( +from software.gameplay_tests.validation.robot_at_orientation import ( RobotEventuallyAtOrientation, ) -from software.simulated_tests.validation.robot_at_position import ( +from software.gameplay_tests.validation.robot_at_position import ( RobotEventuallyAtPosition, ) from software.simulated_tests.simulated_test_fixture import pytest_main diff --git a/src/software/ai/hl/stp/tactic/chip/BUILD b/src/software/ai/hl/stp/tactic/chip/BUILD index 5b5124cb78..4dccbbe6c4 100644 --- a/src/software/ai/hl/stp/tactic/chip/BUILD +++ b/src/software/ai/hl/stp/tactic/chip/BUILD @@ -39,7 +39,7 @@ py_test( ], deps = [ "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) diff --git a/src/software/ai/hl/stp/tactic/chip/chip_tactic_test.py b/src/software/ai/hl/stp/tactic/chip/chip_tactic_test.py index 4aad0c5249..529acea570 100644 --- a/src/software/ai/hl/stp/tactic/chip/chip_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/chip/chip_tactic_test.py @@ -3,10 +3,10 @@ import software.python_bindings as tbots_cpp from software.py_constants import ROBOT_MAX_RADIUS_METERS -from software.simulated_tests.validation.ball_is_off_ground import ( +from software.gameplay_tests.validation.ball_is_off_ground import ( BallIsEventuallyOffGround, ) -from software.simulated_tests.validation.ball_kicked_in_direction import ( +from software.gameplay_tests.validation.ball_kicked_in_direction import ( BallEventuallyKickedInDirection, ) from software.simulated_tests.simulated_test_fixture import ( diff --git a/src/software/ai/hl/stp/tactic/crease_defender/BUILD b/src/software/ai/hl/stp/tactic/crease_defender/BUILD index 58467ae6a5..b2cd797b85 100644 --- a/src/software/ai/hl/stp/tactic/crease_defender/BUILD +++ b/src/software/ai/hl/stp/tactic/crease_defender/BUILD @@ -43,7 +43,7 @@ py_test( ], deps = [ "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) diff --git a/src/software/ai/hl/stp/tactic/crease_defender/crease_defender_tactic_test.py b/src/software/ai/hl/stp/tactic/crease_defender/crease_defender_tactic_test.py index bfa92f4afd..66ce091748 100644 --- a/src/software/ai/hl/stp/tactic/crease_defender/crease_defender_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/crease_defender/crease_defender_tactic_test.py @@ -8,18 +8,18 @@ MaxAllowedSpeedMode, ) from proto.message_translation.tbots_protobuf import create_world_state -from software.simulated_tests.validation.ball_is_off_ground import ( +from software.gameplay_tests.validation.ball_is_off_ground import ( BallIsAlwaysOnGround, BallIsEventuallyOffGround, ) -from software.simulated_tests.validation.ball_speed_threshold import ( +from software.gameplay_tests.validation.ball_speed_threshold import ( BallSpeedAlwaysBelowThreshold, ) -from software.simulated_tests.validation.delay_validation import DelayValidation -from software.simulated_tests.validation.excessive_dribbling import ( +from software.gameplay_tests.validation.delay_validation import DelayValidation +from software.gameplay_tests.validation.excessive_dribbling import ( NeverExcessivelyDribbles, ) -from software.simulated_tests.validation.robot_enters_region import ( +from software.gameplay_tests.validation.robot_enters_region import ( RobotEventuallyEntersRegion, RobotNeverEntersRegion, ) diff --git a/src/software/ai/hl/stp/tactic/dribble/BUILD b/src/software/ai/hl/stp/tactic/dribble/BUILD index 7916893668..d696b5657e 100644 --- a/src/software/ai/hl/stp/tactic/dribble/BUILD +++ b/src/software/ai/hl/stp/tactic/dribble/BUILD @@ -42,7 +42,7 @@ py_test( ], deps = [ "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) diff --git a/src/software/ai/hl/stp/tactic/dribble/dribble_tactic_test.py b/src/software/ai/hl/stp/tactic/dribble/dribble_tactic_test.py index c138969def..6be8d842d7 100644 --- a/src/software/ai/hl/stp/tactic/dribble/dribble_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/dribble/dribble_tactic_test.py @@ -4,21 +4,21 @@ from proto.import_all_protos import DribbleTactic from proto.message_translation.tbots_protobuf import create_world_state -from software.simulated_tests.validation.ball_enters_region import ( +from software.gameplay_tests.validation.ball_enters_region import ( BallAlwaysStaysInRegion, BallEventuallyEntersRegion, ) -from software.simulated_tests.validation.excessive_dribbling import ( +from software.gameplay_tests.validation.excessive_dribbling import ( EventuallyStartsExcessivelyDribbling, NeverExcessivelyDribbles, ) -from software.simulated_tests.validation.robot_at_orientation import ( +from software.gameplay_tests.validation.robot_at_orientation import ( RobotEventuallyAtOrientation, ) -from software.simulated_tests.validation.robot_received_ball import ( +from software.gameplay_tests.validation.robot_received_ball import ( RobotEventuallyReceivedBall, ) -from software.simulated_tests.validation.delay_validation import ( +from software.gameplay_tests.validation.delay_validation import ( DelayValidation, ) from software.simulated_tests.simulated_test_fixture import ( diff --git a/src/software/ai/hl/stp/tactic/goalie/BUILD b/src/software/ai/hl/stp/tactic/goalie/BUILD index 47d8f9f8af..21d6e04514 100644 --- a/src/software/ai/hl/stp/tactic/goalie/BUILD +++ b/src/software/ai/hl/stp/tactic/goalie/BUILD @@ -58,7 +58,7 @@ py_test( ], deps = [ "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) diff --git a/src/software/ai/hl/stp/tactic/goalie/goalie_tactic_test.py b/src/software/ai/hl/stp/tactic/goalie/goalie_tactic_test.py index 2111109524..369a4a1f9c 100644 --- a/src/software/ai/hl/stp/tactic/goalie/goalie_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/goalie/goalie_tactic_test.py @@ -2,13 +2,13 @@ import software.python_bindings as tbots_cpp from proto.import_all_protos import * -from software.simulated_tests.validation.robot_enters_region import * -from software.simulated_tests.validation.ball_enters_region import * -from software.simulated_tests.validation.ball_moves_in_direction import * -from software.simulated_tests.validation.friendly_has_ball_possession import * -from software.simulated_tests.validation.ball_speed_threshold import * -from software.simulated_tests.validation.robot_speed_threshold import * -from software.simulated_tests.validation.excessive_dribbling import * +from software.gameplay_tests.validation.robot_enters_region import * +from software.gameplay_tests.validation.ball_enters_region import * +from software.gameplay_tests.validation.ball_moves_in_direction import * +from software.gameplay_tests.validation.friendly_has_ball_possession import * +from software.gameplay_tests.validation.ball_speed_threshold import * +from software.gameplay_tests.validation.robot_speed_threshold import * +from software.gameplay_tests.validation.excessive_dribbling import * from software.simulated_tests.simulated_test_fixture import ( pytest_main, ) diff --git a/src/software/ai/hl/stp/tactic/halt/BUILD b/src/software/ai/hl/stp/tactic/halt/BUILD index f32f65094e..53ae62a187 100644 --- a/src/software/ai/hl/stp/tactic/halt/BUILD +++ b/src/software/ai/hl/stp/tactic/halt/BUILD @@ -37,7 +37,7 @@ py_test( ], deps = [ "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) diff --git a/src/software/ai/hl/stp/tactic/halt/halt_tactic_test.py b/src/software/ai/hl/stp/tactic/halt/halt_tactic_test.py index 4c7466c2e8..018615a643 100644 --- a/src/software/ai/hl/stp/tactic/halt/halt_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/halt/halt_tactic_test.py @@ -5,10 +5,10 @@ HaltTactic, ) from proto.message_translation.tbots_protobuf import create_world_state -from software.simulated_tests.validation.robot_speed_threshold import ( +from software.gameplay_tests.validation.robot_speed_threshold import ( RobotSpeedEventuallyBelowThreshold, ) -from software.simulated_tests.validation.delay_validation import DelayValidation +from software.gameplay_tests.validation.delay_validation import DelayValidation from software.simulated_tests.simulated_test_fixture import ( pytest_main, ) diff --git a/src/software/ai/hl/stp/tactic/kick/BUILD b/src/software/ai/hl/stp/tactic/kick/BUILD index 17c554eca9..7755889e0c 100644 --- a/src/software/ai/hl/stp/tactic/kick/BUILD +++ b/src/software/ai/hl/stp/tactic/kick/BUILD @@ -39,7 +39,7 @@ py_test( ], deps = [ "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) diff --git a/src/software/ai/hl/stp/tactic/kick/kick_tactic_test.py b/src/software/ai/hl/stp/tactic/kick/kick_tactic_test.py index 19eceb1f0e..6ae25e19bc 100644 --- a/src/software/ai/hl/stp/tactic/kick/kick_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/kick/kick_tactic_test.py @@ -4,7 +4,7 @@ from proto.import_all_protos import KickTactic from proto.message_translation.tbots_protobuf import create_world_state -from software.simulated_tests.validation.ball_kicked_in_direction import ( +from software.gameplay_tests.validation.ball_kicked_in_direction import ( BallEventuallyKickedInDirection, ) from software.simulated_tests.simulated_test_fixture import ( diff --git a/src/software/ai/hl/stp/tactic/move/BUILD b/src/software/ai/hl/stp/tactic/move/BUILD index 966f452179..7f0a827dc7 100644 --- a/src/software/ai/hl/stp/tactic/move/BUILD +++ b/src/software/ai/hl/stp/tactic/move/BUILD @@ -38,7 +38,7 @@ py_test( ], deps = [ "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", "//software/gameplay_tests:util", requirement("pytest"), ], diff --git a/src/software/ai/hl/stp/tactic/move/move_tactic_test.py b/src/software/ai/hl/stp/tactic/move/move_tactic_test.py index d1179f0508..fe785c36db 100644 --- a/src/software/ai/hl/stp/tactic/move/move_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/move/move_tactic_test.py @@ -1,22 +1,22 @@ import pytest import software.python_bindings as tbots_cpp -from software.simulated_tests.validation.robot_at_position import ( +from software.gameplay_tests.validation.robot_at_position import ( RobotEventuallyAtPosition, ) -from software.simulated_tests.validation.ball_kicked_in_direction import ( +from software.gameplay_tests.validation.ball_kicked_in_direction import ( BallEventuallyKickedInDirection, ) -from software.simulated_tests.validation.robot_at_orientation import ( +from software.gameplay_tests.validation.robot_at_orientation import ( RobotEventuallyAtOrientation, ) -from software.simulated_tests.validation.ball_is_off_ground import ( +from software.gameplay_tests.validation.ball_is_off_ground import ( BallIsEventuallyOffGround, ) -from software.simulated_tests.validation.robot_at_angular_velocity import ( +from software.gameplay_tests.validation.robot_at_angular_velocity import ( RobotEventuallyAtAngularVelocity, ) -from software.simulated_tests.validation.duration_validation import DurationValidation +from software.gameplay_tests.validation.duration_validation import DurationValidation # from software.simulated_tests.simulated_test_fixture import ( # pytest_main, diff --git a/src/software/ai/hl/stp/tactic/pass_defender/BUILD b/src/software/ai/hl/stp/tactic/pass_defender/BUILD index b83739a0dd..83d729c3c7 100644 --- a/src/software/ai/hl/stp/tactic/pass_defender/BUILD +++ b/src/software/ai/hl/stp/tactic/pass_defender/BUILD @@ -45,7 +45,7 @@ py_test( ], deps = [ "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) diff --git a/src/software/ai/hl/stp/tactic/pass_defender/pass_defender_tactic_test.py b/src/software/ai/hl/stp/tactic/pass_defender/pass_defender_tactic_test.py index fd8ab0c74a..b1f349a3a8 100644 --- a/src/software/ai/hl/stp/tactic/pass_defender/pass_defender_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/pass_defender/pass_defender_tactic_test.py @@ -2,13 +2,13 @@ import software.python_bindings as tbots_cpp from proto.import_all_protos import * -from software.simulated_tests.validation.robot_enters_region import * -from software.simulated_tests.validation.ball_enters_region import * -from software.simulated_tests.validation.ball_moves_in_direction import * -from software.simulated_tests.validation.friendly_has_ball_possession import * -from software.simulated_tests.validation.ball_speed_threshold import * -from software.simulated_tests.validation.robot_speed_threshold import * -from software.simulated_tests.validation.excessive_dribbling import * +from software.gameplay_tests.validation.robot_enters_region import * +from software.gameplay_tests.validation.ball_enters_region import * +from software.gameplay_tests.validation.ball_moves_in_direction import * +from software.gameplay_tests.validation.friendly_has_ball_possession import * +from software.gameplay_tests.validation.ball_speed_threshold import * +from software.gameplay_tests.validation.robot_speed_threshold import * +from software.gameplay_tests.validation.excessive_dribbling import * from software.simulated_tests.simulated_test_fixture import ( pytest_main, ) diff --git a/src/software/ai/hl/stp/tactic/penalty_kick/BUILD b/src/software/ai/hl/stp/tactic/penalty_kick/BUILD index 0c3b424a8a..c1d0b66b48 100644 --- a/src/software/ai/hl/stp/tactic/penalty_kick/BUILD +++ b/src/software/ai/hl/stp/tactic/penalty_kick/BUILD @@ -41,7 +41,7 @@ py_test( tags = ["exclusive"], deps = [ "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) diff --git a/src/software/ai/hl/stp/tactic/penalty_kick/penalty_kick_tactic_test.py b/src/software/ai/hl/stp/tactic/penalty_kick/penalty_kick_tactic_test.py index 0e4713e5ac..9eb9c58321 100644 --- a/src/software/ai/hl/stp/tactic/penalty_kick/penalty_kick_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/penalty_kick/penalty_kick_tactic_test.py @@ -3,13 +3,13 @@ import software.python_bindings as tbots_cpp from proto.import_all_protos import PenaltyKickTactic -from software.simulated_tests.validation.friendly_team_scored import ( +from software.gameplay_tests.validation.friendly_team_scored import ( FriendlyTeamEventuallyScored, ) -from software.simulated_tests.validation.excessive_dribbling import ( +from software.gameplay_tests.validation.excessive_dribbling import ( NeverExcessivelyDribbles, ) -from software.simulated_tests.validation.ball_moves_in_direction import ( +from software.gameplay_tests.validation.ball_moves_in_direction import ( BallAlwaysMovesForward, ) from proto.message_translation.tbots_protobuf import create_world_state diff --git a/src/software/ai/hl/stp/tactic/pivot_kick/BUILD b/src/software/ai/hl/stp/tactic/pivot_kick/BUILD index 7df9c6095d..fca43ba8ed 100644 --- a/src/software/ai/hl/stp/tactic/pivot_kick/BUILD +++ b/src/software/ai/hl/stp/tactic/pivot_kick/BUILD @@ -41,7 +41,7 @@ py_test( ], deps = [ "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) diff --git a/src/software/ai/hl/stp/tactic/pivot_kick/pivot_kick_tactic_test.py b/src/software/ai/hl/stp/tactic/pivot_kick/pivot_kick_tactic_test.py index 8a281bb09b..75c4c0fde9 100644 --- a/src/software/ai/hl/stp/tactic/pivot_kick/pivot_kick_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/pivot_kick/pivot_kick_tactic_test.py @@ -4,7 +4,7 @@ from proto.import_all_protos import * from proto.message_translation.tbots_protobuf import create_world_state -from software.simulated_tests.validation.ball_kicked_in_direction import ( +from software.gameplay_tests.validation.ball_kicked_in_direction import ( BallEventuallyKickedInDirection, ) from software.simulated_tests.simulated_test_fixture import ( diff --git a/src/software/ai/hl/stp/tactic/receiver/BUILD b/src/software/ai/hl/stp/tactic/receiver/BUILD index 2a6f5d59ac..0f4112fd93 100644 --- a/src/software/ai/hl/stp/tactic/receiver/BUILD +++ b/src/software/ai/hl/stp/tactic/receiver/BUILD @@ -43,7 +43,7 @@ py_test( ], deps = [ "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) diff --git a/src/software/ai/hl/stp/tactic/receiver/receiver_tactic_test.py b/src/software/ai/hl/stp/tactic/receiver/receiver_tactic_test.py index 9c07bb3762..759a7a3a5c 100644 --- a/src/software/ai/hl/stp/tactic/receiver/receiver_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/receiver/receiver_tactic_test.py @@ -3,13 +3,13 @@ import software.python_bindings as tbots_cpp from proto.import_all_protos import Pass, ReceiverTactic from proto.message_translation.tbots_protobuf import create_world_state -from software.simulated_tests.validation.friendly_team_scored import ( +from software.gameplay_tests.validation.friendly_team_scored import ( FriendlyTeamEventuallyScored, ) -from software.simulated_tests.validation.robot_at_orientation import ( +from software.gameplay_tests.validation.robot_at_orientation import ( RobotEventuallyAtOrientation, ) -from software.simulated_tests.validation.robot_received_ball import ( +from software.gameplay_tests.validation.robot_received_ball import ( RobotEventuallyReceivedBall, ) from software.simulated_tests.simulated_test_fixture import pytest_main diff --git a/src/software/ai/navigator/trajectory/BUILD b/src/software/ai/navigator/trajectory/BUILD index abc4f5c82f..c3dc62daa6 100644 --- a/src/software/ai/navigator/trajectory/BUILD +++ b/src/software/ai/navigator/trajectory/BUILD @@ -157,7 +157,7 @@ py_test( deps = [ "//proto/message_translation:py_tbots_protobuf", "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) diff --git a/src/software/ai/navigator/trajectory/simulated_hrvo_test.py b/src/software/ai/navigator/trajectory/simulated_hrvo_test.py index 5bcd2a99d2..39f6e11d3e 100644 --- a/src/software/ai/navigator/trajectory/simulated_hrvo_test.py +++ b/src/software/ai/navigator/trajectory/simulated_hrvo_test.py @@ -2,7 +2,7 @@ from software.simulated_tests.simulated_test_fixture import ( pytest_main, ) -from software.simulated_tests.validation.avoid_collisions import * +from software.gameplay_tests.validation.avoid_collisions import * import software.python_bindings as tbots from software.py_constants import * from proto.message_translation.tbots_protobuf import create_world_state @@ -10,7 +10,7 @@ from proto.import_all_protos import * from proto.ssl_gc_common_pb2 import Team from software.simulated_tests.simulated_test_fixture import SimulatedTestRunner -from software.simulated_tests.validation.validation import ( +from software.gameplay_tests.validation.validation import ( create_validation_types, create_validation_geometry, ) diff --git a/src/software/field_tests/BUILD b/src/software/field_tests/BUILD index 96ec19c6e3..6c42e9c284 100644 --- a/src/software/field_tests/BUILD +++ b/src/software/field_tests/BUILD @@ -16,7 +16,7 @@ py_library( "//software/networking/unix:threaded_unix_listener_py", "//software/networking/unix:threaded_unix_sender_py", "//software/simulated_tests:tbots_test_runner", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", "//software/thunderscope", "//software/thunderscope:constants", "//software/thunderscope:estop_helpers", @@ -39,7 +39,7 @@ py_test( deps = [ "//software:conftest", "//software/simulated_tests:tbots_test_runner", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) @@ -56,7 +56,7 @@ py_test( deps = [ "//software:conftest", "//software/simulated_tests:tbots_test_runner", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) @@ -68,7 +68,7 @@ py_test( ], deps = [ "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) diff --git a/src/software/field_tests/field_test_fixture.py b/src/software/field_tests/field_test_fixture.py index ebf0480ac3..7cdafc3393 100644 --- a/src/software/field_tests/field_test_fixture.py +++ b/src/software/field_tests/field_test_fixture.py @@ -7,7 +7,7 @@ import argparse from proto.import_all_protos import * -from software.simulated_tests.validation import validation +from software.gameplay_tests.validation import validation from software.thunderscope.constants import EstopMode, IndividualRobotMode from software.thunderscope.thunderscope import Thunderscope from software.thunderscope.proto_unix_io import ProtoUnixIO diff --git a/src/software/field_tests/passing_field_test.py b/src/software/field_tests/passing_field_test.py index 43785bb5d4..24bde002ba 100644 --- a/src/software/field_tests/passing_field_test.py +++ b/src/software/field_tests/passing_field_test.py @@ -1,7 +1,7 @@ import software.python_bindings as tbots_cpp from proto.import_all_protos import * from software.field_tests.field_test_fixture import * -from software.simulated_tests.validation.friendly_receives_ball_slow import ( +from software.gameplay_tests.validation.friendly_receives_ball_slow import ( FriendlyAlwaysReceivesBallSlow, ) from software.simulated_tests.simulated_test_fixture import ( diff --git a/src/software/gameplay_tests/simulated_test_runner.py b/src/software/gameplay_tests/simulated_test_runner.py index 510e448616..3f6f8f5d81 100644 --- a/src/software/gameplay_tests/simulated_test_runner.py +++ b/src/software/gameplay_tests/simulated_test_runner.py @@ -9,7 +9,7 @@ from proto.import_all_protos import * from software.logger.logger import create_logger from software.simulated_tests.tbots_test_runner import TbotsTestRunner -from software.simulated_tests.validation import validation +from software.gameplay_tests.validation import validation from software.thunderscope.thread_safe_buffer import ThreadSafeBuffer logger = create_logger(__name__) diff --git a/src/software/simulated_tests/validation/BUILD b/src/software/gameplay_tests/validation/BUILD similarity index 100% rename from src/software/simulated_tests/validation/BUILD rename to src/software/gameplay_tests/validation/BUILD diff --git a/src/software/simulated_tests/validation/__init__.py b/src/software/gameplay_tests/validation/__init__.py similarity index 100% rename from src/software/simulated_tests/validation/__init__.py rename to src/software/gameplay_tests/validation/__init__.py diff --git a/src/software/simulated_tests/validation/avoid_collisions.py b/src/software/gameplay_tests/validation/avoid_collisions.py similarity index 99% rename from src/software/simulated_tests/validation/avoid_collisions.py rename to src/software/gameplay_tests/validation/avoid_collisions.py index 41953cd994..6ac44f7db9 100644 --- a/src/software/simulated_tests/validation/avoid_collisions.py +++ b/src/software/gameplay_tests/validation/avoid_collisions.py @@ -1,7 +1,7 @@ from software.py_constants import * import software.python_bindings as tbots from proto.import_all_protos import * -from software.simulated_tests.validation.validation import ( +from software.gameplay_tests.validation.validation import ( Validation, create_validation_types, create_validation_geometry, diff --git a/src/software/simulated_tests/validation/ball_enters_region.py b/src/software/gameplay_tests/validation/ball_enters_region.py similarity index 96% rename from src/software/simulated_tests/validation/ball_enters_region.py rename to src/software/gameplay_tests/validation/ball_enters_region.py index ff6e840f59..359a44bfff 100644 --- a/src/software/simulated_tests/validation/ball_enters_region.py +++ b/src/software/gameplay_tests/validation/ball_enters_region.py @@ -1,7 +1,7 @@ import software.python_bindings as tbots_cpp from proto.import_all_protos import * -from software.simulated_tests.validation.validation import ( +from software.gameplay_tests.validation.validation import ( Validation, create_validation_geometry, create_validation_types, diff --git a/src/software/simulated_tests/validation/ball_is_off_ground.py b/src/software/gameplay_tests/validation/ball_is_off_ground.py similarity index 98% rename from src/software/simulated_tests/validation/ball_is_off_ground.py rename to src/software/gameplay_tests/validation/ball_is_off_ground.py index 880150c838..26b8c6a760 100644 --- a/src/software/simulated_tests/validation/ball_is_off_ground.py +++ b/src/software/gameplay_tests/validation/ball_is_off_ground.py @@ -1,7 +1,7 @@ import software.python_bindings as tbots_cpp from proto.import_all_protos import * -from software.simulated_tests.validation.validation import ( +from software.gameplay_tests.validation.validation import ( Validation, create_validation_geometry, create_validation_types, diff --git a/src/software/simulated_tests/validation/ball_kicked_in_direction.py b/src/software/gameplay_tests/validation/ball_kicked_in_direction.py similarity index 97% rename from src/software/simulated_tests/validation/ball_kicked_in_direction.py rename to src/software/gameplay_tests/validation/ball_kicked_in_direction.py index 3bd99978ce..40d9669b1e 100644 --- a/src/software/simulated_tests/validation/ball_kicked_in_direction.py +++ b/src/software/gameplay_tests/validation/ball_kicked_in_direction.py @@ -1,7 +1,7 @@ import software.python_bindings as tbots_cpp from proto.import_all_protos import * -from software.simulated_tests.validation.validation import ( +from software.gameplay_tests.validation.validation import ( Validation, create_validation_geometry, create_validation_types, diff --git a/src/software/simulated_tests/validation/ball_moves_in_direction.py b/src/software/gameplay_tests/validation/ball_moves_in_direction.py similarity index 98% rename from src/software/simulated_tests/validation/ball_moves_in_direction.py rename to src/software/gameplay_tests/validation/ball_moves_in_direction.py index 533d818fc7..fb2c99fc0f 100644 --- a/src/software/simulated_tests/validation/ball_moves_in_direction.py +++ b/src/software/gameplay_tests/validation/ball_moves_in_direction.py @@ -1,7 +1,7 @@ import software.python_bindings as tbots from proto.import_all_protos import * -from software.simulated_tests.validation.validation import ( +from software.gameplay_tests.validation.validation import ( Validation, create_validation_geometry, create_validation_types, diff --git a/src/software/simulated_tests/validation/ball_speed_threshold.py b/src/software/gameplay_tests/validation/ball_speed_threshold.py similarity index 94% rename from src/software/simulated_tests/validation/ball_speed_threshold.py rename to src/software/gameplay_tests/validation/ball_speed_threshold.py index f1f8dcec46..240c6db4e4 100644 --- a/src/software/simulated_tests/validation/ball_speed_threshold.py +++ b/src/software/gameplay_tests/validation/ball_speed_threshold.py @@ -1,9 +1,9 @@ import software.python_bindings as tbots_cpp from proto.import_all_protos import * from software.py_constants import * -from software.simulated_tests.validation.speed_threshold_helpers import * +from software.gameplay_tests.validation.speed_threshold_helpers import * -from software.simulated_tests.validation.validation import ( +from software.gameplay_tests.validation.validation import ( Validation, create_validation_geometry, create_validation_types, diff --git a/src/software/simulated_tests/validation/ball_stops_in_region.py b/src/software/gameplay_tests/validation/ball_stops_in_region.py similarity index 96% rename from src/software/simulated_tests/validation/ball_stops_in_region.py rename to src/software/gameplay_tests/validation/ball_stops_in_region.py index 38b0312481..0506865964 100644 --- a/src/software/simulated_tests/validation/ball_stops_in_region.py +++ b/src/software/gameplay_tests/validation/ball_stops_in_region.py @@ -1,7 +1,7 @@ import software.python_bindings as tbots_cpp from proto.import_all_protos import * -from software.simulated_tests.validation.validation import ( +from software.gameplay_tests.validation.validation import ( Validation, create_validation_geometry, create_validation_types, diff --git a/src/software/simulated_tests/validation/delay_validation.py b/src/software/gameplay_tests/validation/delay_validation.py similarity index 96% rename from src/software/simulated_tests/validation/delay_validation.py rename to src/software/gameplay_tests/validation/delay_validation.py index b51725f7d4..29f455ba6b 100644 --- a/src/software/simulated_tests/validation/delay_validation.py +++ b/src/software/gameplay_tests/validation/delay_validation.py @@ -2,7 +2,7 @@ from proto.validation_pb2 import ValidationStatus, ValidationType, ValidationGeometry from software.py_constants import DEFAULT_SIMULATOR_TICK_RATE_SECONDS_PER_TICK -from software.simulated_tests.validation.validation import ( +from software.gameplay_tests.validation.validation import ( Validation, ) diff --git a/src/software/simulated_tests/validation/duration_validation.py b/src/software/gameplay_tests/validation/duration_validation.py similarity index 96% rename from src/software/simulated_tests/validation/duration_validation.py rename to src/software/gameplay_tests/validation/duration_validation.py index 1020e024d2..c400493a61 100644 --- a/src/software/simulated_tests/validation/duration_validation.py +++ b/src/software/gameplay_tests/validation/duration_validation.py @@ -2,7 +2,7 @@ from proto.validation_pb2 import ValidationStatus, ValidationType, ValidationGeometry from software.py_constants import DEFAULT_SIMULATOR_TICK_RATE_SECONDS_PER_TICK -from software.simulated_tests.validation.validation import ( +from software.gameplay_tests.validation.validation import ( Validation, ) diff --git a/src/software/simulated_tests/validation/excessive_dribbling.py b/src/software/gameplay_tests/validation/excessive_dribbling.py similarity index 98% rename from src/software/simulated_tests/validation/excessive_dribbling.py rename to src/software/gameplay_tests/validation/excessive_dribbling.py index 98a386b055..4904ba65a3 100644 --- a/src/software/simulated_tests/validation/excessive_dribbling.py +++ b/src/software/gameplay_tests/validation/excessive_dribbling.py @@ -1,7 +1,7 @@ import software.python_bindings as tbots_cpp from proto.import_all_protos import ValidationStatus, ValidationGeometry -from software.simulated_tests.validation.validation import ( +from software.gameplay_tests.validation.validation import ( Validation, create_validation_geometry, create_validation_types, diff --git a/src/software/simulated_tests/validation/friendly_has_ball_possession.py b/src/software/gameplay_tests/validation/friendly_has_ball_possession.py similarity index 97% rename from src/software/simulated_tests/validation/friendly_has_ball_possession.py rename to src/software/gameplay_tests/validation/friendly_has_ball_possession.py index bf1013f7ed..2bcb90baa3 100644 --- a/src/software/simulated_tests/validation/friendly_has_ball_possession.py +++ b/src/software/gameplay_tests/validation/friendly_has_ball_possession.py @@ -1,7 +1,7 @@ import software.python_bindings as tbots_cpp from proto.import_all_protos import * -from software.simulated_tests.validation.validation import ( +from software.gameplay_tests.validation.validation import ( Validation, create_validation_geometry, create_validation_types, diff --git a/src/software/simulated_tests/validation/friendly_receives_ball_slow.py b/src/software/gameplay_tests/validation/friendly_receives_ball_slow.py similarity index 93% rename from src/software/simulated_tests/validation/friendly_receives_ball_slow.py rename to src/software/gameplay_tests/validation/friendly_receives_ball_slow.py index 219271e001..f94ed02fe8 100644 --- a/src/software/simulated_tests/validation/friendly_receives_ball_slow.py +++ b/src/software/gameplay_tests/validation/friendly_receives_ball_slow.py @@ -1,10 +1,10 @@ import software.python_bindings as tbots_cpp from proto.import_all_protos import * -from software.simulated_tests.validation.validation import ( +from software.gameplay_tests.validation.validation import ( create_validation_types, ) -from software.simulated_tests.validation.friendly_has_ball_possession import ( +from software.gameplay_tests.validation.friendly_has_ball_possession import ( FriendlyHasBallPossession, ) from typing import override diff --git a/src/software/simulated_tests/validation/friendly_team_scored.py b/src/software/gameplay_tests/validation/friendly_team_scored.py similarity index 96% rename from src/software/simulated_tests/validation/friendly_team_scored.py rename to src/software/gameplay_tests/validation/friendly_team_scored.py index 458502f152..146e77923b 100644 --- a/src/software/simulated_tests/validation/friendly_team_scored.py +++ b/src/software/gameplay_tests/validation/friendly_team_scored.py @@ -1,7 +1,7 @@ import software.python_bindings as tbots_cpp from proto.import_all_protos import * -from software.simulated_tests.validation.validation import ( +from software.gameplay_tests.validation.validation import ( Validation, create_validation_geometry, create_validation_types, diff --git a/src/software/simulated_tests/validation/or_validation.py b/src/software/gameplay_tests/validation/or_validation.py similarity index 96% rename from src/software/simulated_tests/validation/or_validation.py rename to src/software/gameplay_tests/validation/or_validation.py index b14affe8c3..88ae1180c7 100644 --- a/src/software/simulated_tests/validation/or_validation.py +++ b/src/software/gameplay_tests/validation/or_validation.py @@ -1,5 +1,5 @@ from proto.validation_pb2 import * -from software.simulated_tests.validation.validation import ( +from software.gameplay_tests.validation.validation import ( Validation, ) from typing import override diff --git a/src/software/simulated_tests/validation/robot_at_angular_velocity.py b/src/software/gameplay_tests/validation/robot_at_angular_velocity.py similarity index 97% rename from src/software/simulated_tests/validation/robot_at_angular_velocity.py rename to src/software/gameplay_tests/validation/robot_at_angular_velocity.py index f9fec65db8..bb047de91b 100644 --- a/src/software/simulated_tests/validation/robot_at_angular_velocity.py +++ b/src/software/gameplay_tests/validation/robot_at_angular_velocity.py @@ -1,7 +1,7 @@ import software.python_bindings as tbots_cpp from proto.import_all_protos import * -from software.simulated_tests.validation.validation import ( +from software.gameplay_tests.validation.validation import ( Validation, create_validation_geometry, create_validation_types, diff --git a/src/software/simulated_tests/validation/robot_at_orientation.py b/src/software/gameplay_tests/validation/robot_at_orientation.py similarity index 97% rename from src/software/simulated_tests/validation/robot_at_orientation.py rename to src/software/gameplay_tests/validation/robot_at_orientation.py index df3c113257..cdb85b488f 100644 --- a/src/software/simulated_tests/validation/robot_at_orientation.py +++ b/src/software/gameplay_tests/validation/robot_at_orientation.py @@ -1,7 +1,7 @@ import software.python_bindings as tbots_cpp from proto.import_all_protos import * -from software.simulated_tests.validation.validation import ( +from software.gameplay_tests.validation.validation import ( Validation, create_validation_geometry, create_validation_types, diff --git a/src/software/simulated_tests/validation/robot_at_position.py b/src/software/gameplay_tests/validation/robot_at_position.py similarity index 97% rename from src/software/simulated_tests/validation/robot_at_position.py rename to src/software/gameplay_tests/validation/robot_at_position.py index 0637585254..8943551bd4 100644 --- a/src/software/simulated_tests/validation/robot_at_position.py +++ b/src/software/gameplay_tests/validation/robot_at_position.py @@ -1,7 +1,7 @@ import software.python_bindings as tbots_cpp from proto.import_all_protos import * -from software.simulated_tests.validation.validation import ( +from software.gameplay_tests.validation.validation import ( Validation, ValidationStatus, create_validation_geometry, diff --git a/src/software/simulated_tests/validation/robot_enters_placement_region.py b/src/software/gameplay_tests/validation/robot_enters_placement_region.py similarity index 97% rename from src/software/simulated_tests/validation/robot_enters_placement_region.py rename to src/software/gameplay_tests/validation/robot_enters_placement_region.py index db6275e1f2..37121e6b0c 100644 --- a/src/software/simulated_tests/validation/robot_enters_placement_region.py +++ b/src/software/gameplay_tests/validation/robot_enters_placement_region.py @@ -2,7 +2,7 @@ from software.py_constants import ENEMY_BALL_PLACEMENT_DISTANCE_METERS from proto.import_all_protos import * -from software.simulated_tests.validation.validation import ( +from software.gameplay_tests.validation.validation import ( Validation, create_validation_geometry, create_validation_types, diff --git a/src/software/simulated_tests/validation/robot_enters_region.py b/src/software/gameplay_tests/validation/robot_enters_region.py similarity index 97% rename from src/software/simulated_tests/validation/robot_enters_region.py rename to src/software/gameplay_tests/validation/robot_enters_region.py index d5d6584487..ebdbbf8887 100644 --- a/src/software/simulated_tests/validation/robot_enters_region.py +++ b/src/software/gameplay_tests/validation/robot_enters_region.py @@ -1,7 +1,7 @@ import software.python_bindings as tbots_cpp from proto.import_all_protos import * -from software.simulated_tests.validation.validation import ( +from software.gameplay_tests.validation.validation import ( Validation, create_validation_geometry, create_validation_types, diff --git a/src/software/simulated_tests/validation/robot_enters_region_and_stops.py b/src/software/gameplay_tests/validation/robot_enters_region_and_stops.py similarity index 96% rename from src/software/simulated_tests/validation/robot_enters_region_and_stops.py rename to src/software/gameplay_tests/validation/robot_enters_region_and_stops.py index 5cc4a5b052..1676347665 100644 --- a/src/software/simulated_tests/validation/robot_enters_region_and_stops.py +++ b/src/software/gameplay_tests/validation/robot_enters_region_and_stops.py @@ -2,11 +2,11 @@ from software.py_constants import * from proto.import_all_protos import * -from software.simulated_tests.validation.validation import ( +from software.gameplay_tests.validation.validation import ( create_validation_types, create_validation_geometry, ) -from software.simulated_tests.validation.robot_enters_region import ( +from software.gameplay_tests.validation.robot_enters_region import ( RobotEntersRegion, ) from typing import override diff --git a/src/software/simulated_tests/validation/robot_received_ball.py b/src/software/gameplay_tests/validation/robot_received_ball.py similarity index 97% rename from src/software/simulated_tests/validation/robot_received_ball.py rename to src/software/gameplay_tests/validation/robot_received_ball.py index 674f75c800..660a492896 100644 --- a/src/software/simulated_tests/validation/robot_received_ball.py +++ b/src/software/gameplay_tests/validation/robot_received_ball.py @@ -1,7 +1,7 @@ import software.python_bindings as tbots_cpp from proto.import_all_protos import * -from software.simulated_tests.validation.validation import ( +from software.gameplay_tests.validation.validation import ( Validation, create_validation_geometry, create_validation_types, diff --git a/src/software/simulated_tests/validation/robot_speed_threshold.py b/src/software/gameplay_tests/validation/robot_speed_threshold.py similarity index 95% rename from src/software/simulated_tests/validation/robot_speed_threshold.py rename to src/software/gameplay_tests/validation/robot_speed_threshold.py index 19e20db786..4b5126175e 100644 --- a/src/software/simulated_tests/validation/robot_speed_threshold.py +++ b/src/software/gameplay_tests/validation/robot_speed_threshold.py @@ -1,11 +1,11 @@ import software.python_bindings as tbots_cpp from proto.import_all_protos import * from software.py_constants import * -from software.simulated_tests.validation.speed_threshold_helpers import * +from software.gameplay_tests.validation.speed_threshold_helpers import * from typing import override -from software.simulated_tests.validation.validation import ( +from software.gameplay_tests.validation.validation import ( Validation, create_validation_geometry, create_validation_types, diff --git a/src/software/simulated_tests/validation/speed_threshold_helpers.py b/src/software/gameplay_tests/validation/speed_threshold_helpers.py similarity index 100% rename from src/software/simulated_tests/validation/speed_threshold_helpers.py rename to src/software/gameplay_tests/validation/speed_threshold_helpers.py diff --git a/src/software/simulated_tests/validation/validation.py b/src/software/gameplay_tests/validation/validation.py similarity index 100% rename from src/software/simulated_tests/validation/validation.py rename to src/software/gameplay_tests/validation/validation.py diff --git a/src/software/sensor_fusion/filter/BUILD b/src/software/sensor_fusion/filter/BUILD index 6116f49da2..90639ae83c 100644 --- a/src/software/sensor_fusion/filter/BUILD +++ b/src/software/sensor_fusion/filter/BUILD @@ -94,7 +94,7 @@ py_test( tags = ["exclusive"], deps = [ "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) diff --git a/src/software/simulated_tests/BUILD b/src/software/simulated_tests/BUILD index d1acb78f3e..ad63716742 100644 --- a/src/software/simulated_tests/BUILD +++ b/src/software/simulated_tests/BUILD @@ -22,7 +22,7 @@ py_library( "//software/logger:py_logger", "//software/networking/unix:threaded_unix_listener_py", "//software/networking/unix:threaded_unix_sender_py", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", "//software/thunderscope", "//software/thunderscope:config", "//software/thunderscope:constants", @@ -47,7 +47,7 @@ py_library( "//software/logger:py_logger", "//software/networking/unix:threaded_unix_listener_py", "//software/networking/unix:threaded_unix_sender_py", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", "//software/thunderscope", "//software/thunderscope/binary_context_managers:full_system", "//software/thunderscope/binary_context_managers:game_controller", @@ -66,7 +66,7 @@ py_test( ], deps = [ "//software:conftest", - "//software/simulated_tests/validation:validations", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) diff --git a/src/software/simulated_tests/simulated_test_ball_model.py b/src/software/simulated_tests/simulated_test_ball_model.py index f5653d2612..73c1d9c08a 100644 --- a/src/software/simulated_tests/simulated_test_ball_model.py +++ b/src/software/simulated_tests/simulated_test_ball_model.py @@ -1,14 +1,14 @@ import pytest import software.python_bindings as tbots_cpp -from software.simulated_tests.validation.robot_enters_region import * -from software.simulated_tests.validation.ball_enters_region import * -from software.simulated_tests.validation.ball_moves_in_direction import * -from software.simulated_tests.validation.friendly_has_ball_possession import * -from software.simulated_tests.validation.ball_speed_threshold import * -from software.simulated_tests.validation.robot_speed_threshold import * -from software.simulated_tests.validation.ball_stops_in_region import * -from software.simulated_tests.validation.excessive_dribbling import * +from software.gameplay_tests.validation.robot_enters_region import * +from software.gameplay_tests.validation.ball_enters_region import * +from software.gameplay_tests.validation.ball_moves_in_direction import * +from software.gameplay_tests.validation.friendly_has_ball_possession import * +from software.gameplay_tests.validation.ball_speed_threshold import * +from software.gameplay_tests.validation.robot_speed_threshold import * +from software.gameplay_tests.validation.ball_stops_in_region import * +from software.gameplay_tests.validation.excessive_dribbling import * from proto.message_translation.tbots_protobuf import create_world_state from software.simulated_tests.simulated_test_fixture import ( pytest_main, diff --git a/src/software/simulated_tests/simulated_test_fixture.py b/src/software/simulated_tests/simulated_test_fixture.py index 25e92dce64..d363af0011 100644 --- a/src/software/simulated_tests/simulated_test_fixture.py +++ b/src/software/simulated_tests/simulated_test_fixture.py @@ -8,7 +8,7 @@ import pytest from proto.import_all_protos import * -from software.simulated_tests.validation import validation +from software.gameplay_tests.validation import validation from software.simulated_tests.tbots_test_runner import TbotsTestRunner from software.thunderscope.thunderscope import Thunderscope from software.thunderscope.proto_unix_io import ProtoUnixIO From c2d8e66afb04d4fa69c90100d54500e9c1937f70 Mon Sep 17 00:00:00 2001 From: Eric Xiao Date: Tue, 26 May 2026 17:19:29 -0700 Subject: [PATCH 03/18] Delete simulated_tests, replace with gameplay_tests --- .github/workflows/main.yml | 3 - scripts/compile_pip_requirements.sh | 2 +- src/MODULE.bazel | 6 +- src/software/BUILD | 1 - src/software/ai/hl/stp/play/BUILD | 2 +- .../ai/hl/stp/play/ball_placement/BUILD | 2 +- .../ball_placement_play_test.py | 32 +- .../ai/hl/stp/play/crease_defense/BUILD | 2 +- .../crease_defense_play_test.py | 12 +- src/software/ai/hl/stp/play/defense/BUILD | 2 +- .../hl/stp/play/defense/defense_play_test.py | 26 +- .../ai/hl/stp/play/enemy_ball_placement/BUILD | 2 +- .../enemy_ball_placement_play_test.py | 14 +- .../ai/hl/stp/play/enemy_free_kick/BUILD | 2 +- .../enemy_free_kick_play_test.py | 14 +- src/software/ai/hl/stp/play/example/BUILD | 2 +- .../hl/stp/play/example/example_play_test.py | 16 +- src/software/ai/hl/stp/play/free_kick/BUILD | 2 +- .../stp/play/free_kick/free_kick_play_test.py | 16 +- src/software/ai/hl/stp/play/halt_play/BUILD | 2 +- .../hl/stp/play/halt_play/halt_play_test.py | 12 +- .../ai/hl/stp/play/kickoff_enemy/BUILD | 2 +- .../kickoff_enemy/kickoff_enemy_play_test.py | 16 +- .../ai/hl/stp/play/kickoff_friendly/BUILD | 2 +- .../kickoff_friendly_play_test.py | 16 +- .../ai/hl/stp/play/kickoff_play_test.py | 18 +- src/software/ai/hl/stp/play/offense/BUILD | 2 +- .../hl/stp/play/offense/offense_play_test.py | 14 +- .../ai/hl/stp/play/passing_sim_test.py | 22 +- .../ai/hl/stp/play/penalty_kick_enemy/BUILD | 2 +- .../penalty_kick_enemy_play_test.py | 14 +- .../ai/hl/stp/play/shoot_or_chip/BUILD | 2 +- .../shoot_or_chip/shoot_or_chip_play_test.py | 14 +- .../ai/hl/stp/play/shoot_or_pass/BUILD | 2 +- .../shoot_or_pass/shoot_or_pass_play_test.py | 14 +- src/software/ai/hl/stp/play/stop_play_test.py | 12 +- src/software/ai/hl/stp/tactic/attacker/BUILD | 2 +- .../tactic/attacker/attacker_tactic_test.py | 26 +- src/software/ai/hl/stp/tactic/chip/BUILD | 2 +- .../ai/hl/stp/tactic/chip/chip_tactic_test.py | 10 +- .../ai/hl/stp/tactic/crease_defender/BUILD | 2 +- .../crease_defender_tactic_test.py | 42 +- src/software/ai/hl/stp/tactic/defender/BUILD | 2 +- src/software/ai/hl/stp/tactic/dribble/BUILD | 2 +- .../stp/tactic/dribble/dribble_tactic_test.py | 42 +- src/software/ai/hl/stp/tactic/goalie/BUILD | 2 +- .../stp/tactic/goalie/goalie_tactic_test.py | 18 +- src/software/ai/hl/stp/tactic/halt/BUILD | 2 +- .../ai/hl/stp/tactic/halt/halt_tactic_test.py | 10 +- src/software/ai/hl/stp/tactic/kick/BUILD | 2 +- .../ai/hl/stp/tactic/kick/kick_tactic_test.py | 10 +- src/software/ai/hl/stp/tactic/move/BUILD | 2 +- .../ai/hl/stp/tactic/move/move_tactic_test.py | 26 +- .../ai/hl/stp/tactic/pass_defender/BUILD | 2 +- .../pass_defender_tactic_test.py | 26 +- .../ai/hl/stp/tactic/penalty_kick/BUILD | 2 +- .../penalty_kick/penalty_kick_tactic_test.py | 10 +- .../ai/hl/stp/tactic/pivot_kick/BUILD | 2 +- .../pivot_kick/pivot_kick_tactic_test.py | 10 +- src/software/ai/hl/stp/tactic/receiver/BUILD | 2 +- .../tactic/receiver/receiver_tactic_test.py | 10 +- .../ai/hl/stp/tactic/shadow_enemy/BUILD | 2 +- src/software/ai/navigator/trajectory/BUILD | 4 +- .../trajectory/simulated_hrvo_test.py | 24 +- src/software/conftest.py | 1 - src/software/field_tests/BUILD | 8 +- .../field_tests/field_test_fixture.py | 2 +- .../field_tests/movement_robot_field_test.py | 10 +- .../field_tests/passing_field_test.py | 2 +- .../field_tests/pivot_kick_field_test.py | 4 +- .../gameplay_tests/requirements_lock.txt | 4 +- .../gameplay_tests/simulated_test_runner.py | 2 +- src/software/logger/logger.h | 2 +- src/software/sensor_fusion/filter/BUILD | 2 +- .../filter/ball_occlusion_test.py | 12 +- src/software/simulated_tests/BUILD | 72 --- src/software/simulated_tests/requirements.in | 1 - .../simulated_tests/requirements_lock.txt | 34 - .../simulated_test_ball_model.py | 193 ------ .../simulated_tests/simulated_test_fixture.py | 607 ------------------ .../simulated_tests/tbots_test_runner.py | 161 ----- src/software/thunderscope/replay/test/BUILD | 2 +- .../replay/test/replay_corruption_test.py | 2 +- .../replay/test/replay_indexing_test.py | 2 +- 84 files changed, 335 insertions(+), 1408 deletions(-) delete mode 100644 src/software/simulated_tests/BUILD delete mode 100644 src/software/simulated_tests/requirements.in delete mode 100644 src/software/simulated_tests/requirements_lock.txt delete mode 100644 src/software/simulated_tests/simulated_test_ball_model.py delete mode 100644 src/software/simulated_tests/simulated_test_fixture.py delete mode 100644 src/software/simulated_tests/tbots_test_runner.py diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e557f2d2a5..7080adbade 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,7 +27,6 @@ jobs: cd src bazel build --show_timestamps --copt=-O3 --verbose_failures \ -- //... -//software:unix_full_system \ - -//software/simulated_tests/... \ -//software/ai/hl/... \ -//software/field_tests/... \ -//software/embedded/... \ @@ -52,7 +51,6 @@ jobs: cd src bazel test --copt=-O3 --show_timestamps --verbose_failures \ -- //... -//software:unix_full_system \ - -//software/simulated_tests/... \ -//software/ai/hl/... \ -//software/field_tests/... \ -//software/ai/navigator/... \ @@ -87,7 +85,6 @@ jobs: cd src bazel test --copt=-O3 --flaky_test_attempts=3 --show_timestamps \ //software:unix_full_system \ - //software/simulated_tests/... \ //software/ai/hl/... \ //software/ai/navigator/... diff --git a/scripts/compile_pip_requirements.sh b/scripts/compile_pip_requirements.sh index baa1946e74..2e76cb9b13 100755 --- a/scripts/compile_pip_requirements.sh +++ b/scripts/compile_pip_requirements.sh @@ -17,6 +17,6 @@ BAZEL_ROOT_DIR="$CURR_DIR/../src" cd $BAZEL_ROOT_DIR bazel run //software/thunderscope:requirements.update bazel run //software/embedded/ansible:requirements.update -bazel run //software/simulated_tests:requirements.update +bazel run //software/gameplay_tests:requirements.update bazel run //software/embedded/robot_diagnostics_cli:requirements.update bazel run //starlark/nanopb:requirements.update diff --git a/src/MODULE.bazel b/src/MODULE.bazel index 323fd7de00..853820601d 100644 --- a/src/MODULE.bazel +++ b/src/MODULE.bazel @@ -50,12 +50,12 @@ pip.parse( ) use_repo(pip, "ansible_deps") pip.parse( - hub_name = "simulated_tests_deps", + hub_name = "gameplay_tests_deps", python_interpreter = "/opt/tbotspython/bin/python", python_version = "3.12", - requirements_lock = "//software/simulated_tests:requirements_lock.txt", + requirements_lock = "//software/gameplay_tests:requirements_lock.txt", ) -use_repo(pip, "simulated_tests_deps") +use_repo(pip, "gameplay_tests_deps") pip.parse( hub_name = "robot_diagnostics_cli_deps", python_interpreter = "/opt/tbotspython/bin/python", diff --git a/src/software/BUILD b/src/software/BUILD index bfc68c106d..eff57d214b 100644 --- a/src/software/BUILD +++ b/src/software/BUILD @@ -126,7 +126,6 @@ py_library( srcs = ["conftest.py"], deps = [ "//software/field_tests:field_test_fixture", - "//software/simulated_tests:simulated_test_fixture", "//software/gameplay_tests:fixture", ], ) diff --git a/src/software/ai/hl/stp/play/BUILD b/src/software/ai/hl/stp/play/BUILD index 65c2424512..9f40f8cc8f 100644 --- a/src/software/ai/hl/stp/play/BUILD +++ b/src/software/ai/hl/stp/play/BUILD @@ -1,4 +1,4 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) diff --git a/src/software/ai/hl/stp/play/ball_placement/BUILD b/src/software/ai/hl/stp/play/ball_placement/BUILD index 1551805e1b..2258fee4b2 100644 --- a/src/software/ai/hl/stp/play/ball_placement/BUILD +++ b/src/software/ai/hl/stp/play/ball_placement/BUILD @@ -1,4 +1,4 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) diff --git a/src/software/ai/hl/stp/play/ball_placement/ball_placement_play_test.py b/src/software/ai/hl/stp/play/ball_placement/ball_placement_play_test.py index 3e03c3d2cf..f9d550e29c 100644 --- a/src/software/ai/hl/stp/play/ball_placement/ball_placement_play_test.py +++ b/src/software/ai/hl/stp/play/ball_placement/ball_placement_play_test.py @@ -12,7 +12,7 @@ from software.gameplay_tests.validation.robot_enters_region import ( RobotEventuallyExitsRegion, ) -from software.simulated_tests.simulated_test_fixture import ( +from software.gameplay_tests.util import ( pytest_main, ) @@ -33,10 +33,10 @@ ], ) def test_two_ai_ball_placement( - simulated_test_runner, ball_start_point, ball_placement_point + gameplay_test_runner, ball_start_point, ball_placement_point ): run_ball_placement_scenario( - simulated_test_runner, ball_start_point, ball_placement_point + gameplay_test_runner, ball_start_point, ball_placement_point ) @@ -64,21 +64,21 @@ def test_two_ai_ball_placement( ], ) def test_robocup_technical_challenge_placement( - simulated_test_runner, ball_start_point, ball_placement_point + gameplay_test_runner, ball_start_point, ball_placement_point ): run_ball_placement_scenario( - simulated_test_runner, ball_start_point, ball_placement_point, blue_only=True + gameplay_test_runner, ball_start_point, ball_placement_point, blue_only=True ) def ball_placement_play_setup( - ball_start_point, ball_placement_point, simulated_test_runner, blue_only + ball_start_point, ball_placement_point, gameplay_test_runner, blue_only ): """Set up ball placement test by initializing bot positions, ball placement targets, and test settings :param ball_start_point: Initial point of the ball :param ball_placement_point: Target point of the ball - :param simulated_test_runner: Simulated test runner + :param gameplay_test_runner: Simulated test runner :param blue_only: If True, only the blue team is active; the yellow team is ignored. """ # Setup blue robots @@ -113,7 +113,7 @@ def ball_placement_play_setup( ] # Create world state - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( yellow_robot_locations=yellow_bots, blue_robot_locations=blue_bots, @@ -123,28 +123,28 @@ def ball_placement_play_setup( ) # Game Controller Setup - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.STOP, team=Team.UNKNOWN ) # Pass in placement point here - not required for all play tests - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.BALL_PLACEMENT, team=Team.BLUE, final_ball_placement_point=ball_placement_point, ) # Force play override here - simulated_test_runner.set_plays( + gameplay_test_runner.set_plays( blue_play=PlayName.BallPlacementPlay, yellow_play=PlayName.HaltPlay ) def run_ball_placement_scenario( - simulated_test_runner, ball_start_point, ball_placement_point, blue_only=False + gameplay_test_runner, ball_start_point, ball_placement_point, blue_only=False ): """Runs a ball placement test scenario with the specified parameters. - :param simulated_test_runner: The test runner used to simulate robot and ball behavior. + :param gameplay_test_runner: The test runner used to simulate robot and ball behavior. :param ball_start_point: The initial position of the ball. :param ball_placement_point: The target position where the ball should be placed. :param blue_only: If True, only the blue team is active; the yellow team is ignored. @@ -183,11 +183,11 @@ def run_ball_placement_scenario( ] ] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=lambda test_setup_arg: ball_placement_play_setup( test_setup_arg["ball_start_point"], test_setup_arg["ball_placement_point"], - simulated_test_runner, + gameplay_test_runner, blue_only, ), params=[ @@ -203,7 +203,7 @@ def run_ball_placement_scenario( test_timeout_s=[15], ) - simulated_test_runner.run_test( + gameplay_test_runner.run_test( # setup argument isn't passed to preserve world state from previous test run inv_always_validation_sequence_set=drop_ball_always_validation_sequence_set, inv_eventually_validation_sequence_set=drop_ball_eventually_validation_sequence_set, diff --git a/src/software/ai/hl/stp/play/crease_defense/BUILD b/src/software/ai/hl/stp/play/crease_defense/BUILD index 5b62e4d79c..eca2d78c1e 100644 --- a/src/software/ai/hl/stp/play/crease_defense/BUILD +++ b/src/software/ai/hl/stp/play/crease_defense/BUILD @@ -1,4 +1,4 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) diff --git a/src/software/ai/hl/stp/play/crease_defense/crease_defense_play_test.py b/src/software/ai/hl/stp/play/crease_defense/crease_defense_play_test.py index c23783e599..882fe5caa0 100644 --- a/src/software/ai/hl/stp/play/crease_defense/crease_defense_play_test.py +++ b/src/software/ai/hl/stp/play/crease_defense/crease_defense_play_test.py @@ -3,7 +3,7 @@ from proto.import_all_protos import * from proto.message_translation.tbots_protobuf import create_world_state from proto.ssl_gc_common_pb2 import Team -from software.simulated_tests.simulated_test_fixture import ( +from software.gameplay_tests.util import ( pytest_main, ) from software.gameplay_tests.validation.robot_speed_threshold import ( @@ -15,12 +15,12 @@ from software.gameplay_tests.validation.delay_validation import DelayValidation -def test_crease_defense_play(simulated_test_runner): +def test_crease_defense_play(gameplay_test_runner): field = tbots_cpp.Field.createSSLDivisionBField() goalie_position = tbots_cpp.Point(-4.5, 0) def setup(*args): - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[ goalie_position, @@ -43,11 +43,11 @@ def setup(*args): ), ) - simulated_test_runner.set_plays( + gameplay_test_runner.set_plays( blue_play=PlayName.CreaseDefensePlay, yellow_play=PlayName.HaltPlay ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.STOP, team=Team.UNKNOWN ) @@ -70,7 +70,7 @@ def setup(*args): ] ] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_eventually_validation_sequence_set=eventually_validations, ag_eventually_validation_sequence_set=eventually_validations, diff --git a/src/software/ai/hl/stp/play/defense/BUILD b/src/software/ai/hl/stp/play/defense/BUILD index 6c8e761e81..46b7731aef 100644 --- a/src/software/ai/hl/stp/play/defense/BUILD +++ b/src/software/ai/hl/stp/play/defense/BUILD @@ -1,4 +1,4 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) diff --git a/src/software/ai/hl/stp/play/defense/defense_play_test.py b/src/software/ai/hl/stp/play/defense/defense_play_test.py index 32203c6cd1..03b0f1c560 100644 --- a/src/software/ai/hl/stp/play/defense/defense_play_test.py +++ b/src/software/ai/hl/stp/play/defense/defense_play_test.py @@ -8,7 +8,7 @@ ) from proto.message_translation.tbots_protobuf import create_world_state from proto.ssl_gc_common_pb2 import Team -from software.simulated_tests.simulated_test_fixture import ( +from software.gameplay_tests.util import ( pytest_main, ) @@ -35,11 +35,11 @@ ) ], ) -def test_defense_play_ball_steal(simulated_test_runner, blue_bots, yellow_bots): +def test_defense_play_ball_steal(gameplay_test_runner, blue_bots, yellow_bots): def setup(*args): ball_initial_pos = tbots_cpp.Point(0.93, 0) - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( yellow_robot_locations=yellow_bots, blue_robot_locations=blue_bots, @@ -48,18 +48,18 @@ def setup(*args): ), ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.STOP, team=Team.UNKNOWN ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.FORCE_START, team=Team.BLUE ) - simulated_test_runner.set_plays( + gameplay_test_runner.set_plays( blue_play=PlayName.DefensePlay, yellow_play=PlayName.HaltPlay ) - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, params=[0, 1, 2, 3, 4], # The aggregate test runs 5 times inv_always_validation_sequence_set=[ @@ -100,11 +100,11 @@ def setup(*args): ) ], ) -def test_defense_play(simulated_test_runner, blue_bots, yellow_bots): +def test_defense_play(gameplay_test_runner, blue_bots, yellow_bots): def setup(*args): ball_initial_pos = tbots_cpp.Point(0.9, 2.85) - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( yellow_robot_locations=yellow_bots, blue_robot_locations=blue_bots, @@ -113,18 +113,18 @@ def setup(*args): ), ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.STOP, team=Team.UNKNOWN ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.FORCE_START, team=Team.BLUE ) - simulated_test_runner.set_plays( + gameplay_test_runner.set_plays( blue_play=PlayName.DefensePlay, yellow_play=PlayName.ShootOrPassPlay ) - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, params=[0, 1, 2, 3, 4], # The aggregate test runs 5 times inv_always_validation_sequence_set=[ diff --git a/src/software/ai/hl/stp/play/enemy_ball_placement/BUILD b/src/software/ai/hl/stp/play/enemy_ball_placement/BUILD index 3ca1b7c9ec..42570608d9 100644 --- a/src/software/ai/hl/stp/play/enemy_ball_placement/BUILD +++ b/src/software/ai/hl/stp/play/enemy_ball_placement/BUILD @@ -1,4 +1,4 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) diff --git a/src/software/ai/hl/stp/play/enemy_ball_placement/enemy_ball_placement_play_test.py b/src/software/ai/hl/stp/play/enemy_ball_placement/enemy_ball_placement_play_test.py index 6f0262acbb..07a69ec045 100644 --- a/src/software/ai/hl/stp/play/enemy_ball_placement/enemy_ball_placement_play_test.py +++ b/src/software/ai/hl/stp/play/enemy_ball_placement/enemy_ball_placement_play_test.py @@ -3,7 +3,7 @@ import software.python_bindings as tbots_cpp from proto.play_pb2 import PlayName from software.gameplay_tests.validation.robot_enters_placement_region import * -from software.simulated_tests.simulated_test_fixture import ( +from software.gameplay_tests.util import ( pytest_main, ) from proto.message_translation.tbots_protobuf import create_world_state @@ -20,7 +20,7 @@ ], ) def test_two_ai_ball_placement( - simulated_test_runner, ball_start_point, ball_placement_point + gameplay_test_runner, ball_start_point, ball_placement_point ): def setup(*args): blue_bots = [ @@ -45,7 +45,7 @@ def setup(*args): .negXPosYCorner(), ] - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( yellow_robot_locations=yellow_bots, blue_robot_locations=blue_bots, @@ -54,16 +54,16 @@ def setup(*args): ), ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.STOP, team=Team.UNKNOWN ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.BALL_PLACEMENT, team=Team.YELLOW, final_ball_placement_point=ball_placement_point, ) - simulated_test_runner.set_plays( + gameplay_test_runner.set_plays( blue_play=PlayName.EnemyBallPlacementPlay, yellow_play=PlayName.BallPlacementPlay, ) @@ -72,7 +72,7 @@ def setup(*args): [RobotNeverEntersPlacementRegion(ball_placement_point)] ] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, params=[0], inv_always_validation_sequence_set=always_validation_sequence_set, diff --git a/src/software/ai/hl/stp/play/enemy_free_kick/BUILD b/src/software/ai/hl/stp/play/enemy_free_kick/BUILD index f0be4df238..cd32aceafc 100644 --- a/src/software/ai/hl/stp/play/enemy_free_kick/BUILD +++ b/src/software/ai/hl/stp/play/enemy_free_kick/BUILD @@ -1,4 +1,4 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) diff --git a/src/software/ai/hl/stp/play/enemy_free_kick/enemy_free_kick_play_test.py b/src/software/ai/hl/stp/play/enemy_free_kick/enemy_free_kick_play_test.py index d6666e74f3..e92205ad98 100644 --- a/src/software/ai/hl/stp/play/enemy_free_kick/enemy_free_kick_play_test.py +++ b/src/software/ai/hl/stp/play/enemy_free_kick/enemy_free_kick_play_test.py @@ -13,7 +13,7 @@ ) from proto.message_translation.tbots_protobuf import create_world_state from proto.ssl_gc_common_pb2 import Team -from software.simulated_tests.simulated_test_fixture import ( +from software.gameplay_tests.util import ( pytest_main, ) @@ -97,10 +97,10 @@ "Disabling this test because OrValidation is passed both an always validation and eventually validation" ) def test_enemy_free_kick_play( - simulated_test_runner, blue_bots, yellow_bots, ball_initial_pos + gameplay_test_runner, blue_bots, yellow_bots, ball_initial_pos ): def setup(*args): - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( yellow_robot_locations=yellow_bots, blue_robot_locations=blue_bots, @@ -109,14 +109,14 @@ def setup(*args): ), ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.STOP, team=Team.UNKNOWN ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.DIRECT, team=Team.YELLOW ) - simulated_test_runner.set_plays( + gameplay_test_runner.set_plays( blue_play=PlayName.EnemyFreeKickPlay, yellow_play=PlayName.FreeKickPlay ) @@ -141,7 +141,7 @@ def setup(*args): [RobotEventuallyEntersRegion(regions=[tbots_cpp.Circle(ball_initial_pos, 1)])] ] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, params=[0, 1, 2], inv_eventually_validation_sequence_set=eventually_validation_sequence_set, diff --git a/src/software/ai/hl/stp/play/example/BUILD b/src/software/ai/hl/stp/play/example/BUILD index 85973334fa..709a3d4121 100644 --- a/src/software/ai/hl/stp/play/example/BUILD +++ b/src/software/ai/hl/stp/play/example/BUILD @@ -1,4 +1,4 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) diff --git a/src/software/ai/hl/stp/play/example/example_play_test.py b/src/software/ai/hl/stp/play/example/example_play_test.py index 7b2003881d..d933e6a009 100644 --- a/src/software/ai/hl/stp/play/example/example_play_test.py +++ b/src/software/ai/hl/stp/play/example/example_play_test.py @@ -7,12 +7,12 @@ from proto.ssl_gc_common_pb2 import Team from proto.play_pb2 import PlayName from proto.import_all_protos import Command -from software.simulated_tests.simulated_test_fixture import ( +from software.gameplay_tests.util import ( pytest_main, ) -def test_example_play(simulated_test_runner): +def test_example_play(gameplay_test_runner): ball_initial_pos = tbots_cpp.Point(0, 0) def setup(*args): @@ -38,7 +38,7 @@ def setup(*args): .negXPosYCorner(), ] - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( yellow_robot_locations=yellow_bots, blue_robot_locations=blue_bots, @@ -47,17 +47,17 @@ def setup(*args): ), ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.STOP, team=Team.UNKNOWN ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.NORMAL_START, team=Team.BLUE ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.DIRECT, team=Team.BLUE ) - simulated_test_runner.set_plays( + gameplay_test_runner.set_plays( blue_play=PlayName.ExamplePlay, yellow_play=PlayName.HaltPlay ) @@ -72,7 +72,7 @@ def setup(*args): ] ] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_eventually_validation_sequence_set=eventually_validations, ag_eventually_validation_sequence_set=eventually_validations, diff --git a/src/software/ai/hl/stp/play/free_kick/BUILD b/src/software/ai/hl/stp/play/free_kick/BUILD index 3d54957d92..1d1186aaf9 100644 --- a/src/software/ai/hl/stp/play/free_kick/BUILD +++ b/src/software/ai/hl/stp/play/free_kick/BUILD @@ -1,4 +1,4 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) diff --git a/src/software/ai/hl/stp/play/free_kick/free_kick_play_test.py b/src/software/ai/hl/stp/play/free_kick/free_kick_play_test.py index 6fc077b0cc..2869f38823 100644 --- a/src/software/ai/hl/stp/play/free_kick/free_kick_play_test.py +++ b/src/software/ai/hl/stp/play/free_kick/free_kick_play_test.py @@ -16,7 +16,7 @@ from software.gameplay_tests.validation.ball_kicked_in_direction import ( BallEventuallyKickedInDirection, ) -from software.simulated_tests.simulated_test_fixture import ( +from software.gameplay_tests.util import ( pytest_main, ) @@ -31,7 +31,7 @@ (tbots_cpp.Point(1.5, 0.5), True), ], ) -def test_free_kick_play_friendly(ball_initial_pos, must_score, simulated_test_runner): +def test_free_kick_play_friendly(ball_initial_pos, must_score, gameplay_test_runner): def setup(*args): blue_bots = [ tbots_cpp.Point(-4.5, 0), @@ -53,7 +53,7 @@ def setup(*args): .enemyDefenseArea() .negXPosYCorner(), ] - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=blue_bots, yellow_robot_locations=yellow_bots, @@ -62,17 +62,17 @@ def setup(*args): ), ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.STOP, team=Team.UNKNOWN ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.NORMAL_START, team=Team.BLUE ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.DIRECT, team=Team.BLUE ) - simulated_test_runner.set_plays( + gameplay_test_runner.set_plays( blue_play=PlayName.FreeKickPlay, yellow_play=PlayName.HaltPlay ) @@ -89,7 +89,7 @@ def setup(*args): ], ] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_eventually_validation_sequence_set=eventually_validations, ag_eventually_validation_sequence_set=eventually_validations, diff --git a/src/software/ai/hl/stp/play/halt_play/BUILD b/src/software/ai/hl/stp/play/halt_play/BUILD index f09a9b1eb9..81c3ad55ad 100644 --- a/src/software/ai/hl/stp/play/halt_play/BUILD +++ b/src/software/ai/hl/stp/play/halt_play/BUILD @@ -1,4 +1,4 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) diff --git a/src/software/ai/hl/stp/play/halt_play/halt_play_test.py b/src/software/ai/hl/stp/play/halt_play/halt_play_test.py index fb42822fd8..c918948362 100644 --- a/src/software/ai/hl/stp/play/halt_play/halt_play_test.py +++ b/src/software/ai/hl/stp/play/halt_play/halt_play_test.py @@ -2,14 +2,14 @@ from software.gameplay_tests.validation.robot_speed_threshold import * from proto.message_translation.tbots_protobuf import create_world_state from proto.ssl_gc_common_pb2 import Team -from software.simulated_tests.simulated_test_fixture import ( +from software.gameplay_tests.util import ( pytest_main, ) # TODO issue #2599 - Remove Duration parameter from test # @pytest.mark.parametrize("run_enemy_ai,test_duration", [(False, 20), (True, 20)]) -def test_halt_play(simulated_test_runner): +def test_halt_play(gameplay_test_runner): def setup(*args): ball_initial_pos = tbots_cpp.Point(0, 0) @@ -35,7 +35,7 @@ def setup(*args): .negXPosYCorner(), ] - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( yellow_robot_locations=yellow_bots, blue_robot_locations=blue_bots, @@ -44,15 +44,15 @@ def setup(*args): ), ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.STOP, team=Team.UNKNOWN ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.FORCE_START, team=Team.UNKNOWN ) # params just have to be a list of length 1 to ensure the test runs at least once - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, params=[0], inv_always_validation_sequence_set=[[]], diff --git a/src/software/ai/hl/stp/play/kickoff_enemy/BUILD b/src/software/ai/hl/stp/play/kickoff_enemy/BUILD index ced9473a5f..4d1a520603 100644 --- a/src/software/ai/hl/stp/play/kickoff_enemy/BUILD +++ b/src/software/ai/hl/stp/play/kickoff_enemy/BUILD @@ -1,4 +1,4 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) diff --git a/src/software/ai/hl/stp/play/kickoff_enemy/kickoff_enemy_play_test.py b/src/software/ai/hl/stp/play/kickoff_enemy/kickoff_enemy_play_test.py index 2df9a51b5d..be14bf2df5 100644 --- a/src/software/ai/hl/stp/play/kickoff_enemy/kickoff_enemy_play_test.py +++ b/src/software/ai/hl/stp/play/kickoff_enemy/kickoff_enemy_play_test.py @@ -13,12 +13,12 @@ from proto.message_translation.tbots_protobuf import create_world_state from proto.import_all_protos import Command from proto.ssl_gc_common_pb2 import Team -from software.simulated_tests.simulated_test_fixture import ( +from software.gameplay_tests.util import ( pytest_main, ) -def test_kickoff_enemy_play(simulated_test_runner): +def test_kickoff_enemy_play(gameplay_test_runner): ball_initial_pos = tbots_cpp.Point(0, 0) field = tbots_cpp.Field.createSSLDivisionBField() @@ -41,7 +41,7 @@ def setup(*args): field.enemyDefenseArea().negXPosYCorner(), ] - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=blue_bots, yellow_robot_locations=yellow_bots, @@ -50,22 +50,22 @@ def setup(*args): ), ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.STOP, team=Team.UNKNOWN ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.KICKOFF, team=Team.YELLOW ) # Let robots get ready before starting kickoff threading.Timer( 4.0, - lambda: simulated_test_runner.send_gamecontroller_command( + lambda: gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.NORMAL_START, team=Team.YELLOW ), ).start() - simulated_test_runner.set_plays( + gameplay_test_runner.set_plays( blue_play=PlayName.KickoffEnemyPlay, yellow_play=PlayName.KickoffFriendlyPlay, ) @@ -138,7 +138,7 @@ def setup(*args): ] ] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_eventually_validation_sequence_set=eventually_validation_sequence_set, inv_always_validation_sequence_set=always_validation_sequence_set, diff --git a/src/software/ai/hl/stp/play/kickoff_friendly/BUILD b/src/software/ai/hl/stp/play/kickoff_friendly/BUILD index a31fa94912..b04c36bf90 100644 --- a/src/software/ai/hl/stp/play/kickoff_friendly/BUILD +++ b/src/software/ai/hl/stp/play/kickoff_friendly/BUILD @@ -1,4 +1,4 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) diff --git a/src/software/ai/hl/stp/play/kickoff_friendly/kickoff_friendly_play_test.py b/src/software/ai/hl/stp/play/kickoff_friendly/kickoff_friendly_play_test.py index 51016b9901..236bd6f692 100644 --- a/src/software/ai/hl/stp/play/kickoff_friendly/kickoff_friendly_play_test.py +++ b/src/software/ai/hl/stp/play/kickoff_friendly/kickoff_friendly_play_test.py @@ -17,12 +17,12 @@ from proto.message_translation.tbots_protobuf import create_world_state from proto.ssl_gc_common_pb2 import Team from proto.import_all_protos import Command -from software.simulated_tests.simulated_test_fixture import ( +from software.gameplay_tests.util import ( pytest_main, ) -def test_kickoff_friendly_play(simulated_test_runner): +def test_kickoff_friendly_play(gameplay_test_runner): ball_initial_pos = tbots_cpp.Point(0, 0) def setup(*args): @@ -46,7 +46,7 @@ def setup(*args): field.enemyDefenseArea().negXPosYCorner(), ] - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=blue_bots, yellow_robot_locations=yellow_bots, @@ -55,22 +55,22 @@ def setup(*args): ), ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.STOP, team=Team.UNKNOWN ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.KICKOFF, team=Team.BLUE ) # Let robots get ready before starting kickoff threading.Timer( 4.0, - lambda: simulated_test_runner.send_gamecontroller_command( + lambda: gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.NORMAL_START, team=Team.BLUE ), ).start() - simulated_test_runner.set_plays( + gameplay_test_runner.set_plays( blue_play=PlayName.KickoffFriendlyPlay, yellow_play=PlayName.KickoffEnemyPlay, ) @@ -138,7 +138,7 @@ def setup(*args): ] ] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_eventually_validation_sequence_set=eventually_validation_sequence_set, inv_always_validation_sequence_set=always_validation_sequence_set, diff --git a/src/software/ai/hl/stp/play/kickoff_play_test.py b/src/software/ai/hl/stp/play/kickoff_play_test.py index 2e3f87d0d1..3381a835d1 100644 --- a/src/software/ai/hl/stp/play/kickoff_play_test.py +++ b/src/software/ai/hl/stp/play/kickoff_play_test.py @@ -7,14 +7,14 @@ from proto.import_all_protos import * from proto.message_translation.tbots_protobuf import create_world_state from proto.ssl_gc_common_pb2 import Team -from software.simulated_tests.simulated_test_fixture import ( +from software.gameplay_tests.util import ( pytest_main, ) from software.gameplay_tests.validation.or_validation import OrValidation @pytest.mark.parametrize("is_friendly_test", [True, False]) -def test_kickoff_play(simulated_test_runner, is_friendly_test): +def test_kickoff_play(gameplay_test_runner, is_friendly_test): ball_initial_pos = tbots_cpp.Point(0, 0) def setup(*args): @@ -40,7 +40,7 @@ def setup(*args): .negXPosYCorner(), ] - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( yellow_robot_locations=yellow_bots, blue_robot_locations=blue_bots, @@ -49,28 +49,28 @@ def setup(*args): ), ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.STOP, team=Team.UNKNOWN ) if is_friendly_test: - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.KICKOFF, team=Team.BLUE ) blue_play = PlayName.KickoffFriendlyPlay yellow_play = PlayName.KickoffEnemyPlay else: - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.KICKOFF, team=Team.YELLOW ) blue_play = PlayName.KickoffEnemyPlay yellow_play = PlayName.KickoffFriendlyPlay - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.NORMAL_START, team=Team.BLUE ) - simulated_test_runner.set_plays(blue_play=blue_play, yellow_play=yellow_play) + gameplay_test_runner.set_plays(blue_play=blue_play, yellow_play=yellow_play) # TODO (#3650): fix validation logic @@ -136,7 +136,7 @@ def setup(*args): ) ) - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_eventually_validation_sequence_set=eventually_validation_sequence_set, inv_always_validation_sequence_set=always_validation_sequence_set, diff --git a/src/software/ai/hl/stp/play/offense/BUILD b/src/software/ai/hl/stp/play/offense/BUILD index a3c7a2145e..ee7995a153 100644 --- a/src/software/ai/hl/stp/play/offense/BUILD +++ b/src/software/ai/hl/stp/play/offense/BUILD @@ -1,4 +1,4 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) diff --git a/src/software/ai/hl/stp/play/offense/offense_play_test.py b/src/software/ai/hl/stp/play/offense/offense_play_test.py index 2988abd37c..715afe0f3f 100644 --- a/src/software/ai/hl/stp/play/offense/offense_play_test.py +++ b/src/software/ai/hl/stp/play/offense/offense_play_test.py @@ -6,12 +6,12 @@ from software.gameplay_tests.validation.excessive_dribbling import * from proto.message_translation.tbots_protobuf import create_world_state from proto.ssl_gc_common_pb2 import Team -from software.simulated_tests.simulated_test_fixture import ( +from software.gameplay_tests.util import ( pytest_main, ) -def test_offense_play(simulated_test_runner): +def test_offense_play(gameplay_test_runner): def setup(start_point): ball_initial_pos = start_point @@ -37,7 +37,7 @@ def setup(start_point): .negXPosYCorner(), ] - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( yellow_robot_locations=yellow_bots, blue_robot_locations=blue_bots, @@ -46,14 +46,14 @@ def setup(start_point): ), ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.STOP, team=Team.UNKNOWN ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.FORCE_START, team=Team.BLUE ) - simulated_test_runner.set_plays( + gameplay_test_runner.set_plays( blue_play=PlayName.OffensePlay, yellow_play=PlayName.HaltPlay ) @@ -71,7 +71,7 @@ def setup(start_point): inv_eventually_validation_sequence_set = [[]] ag_eventually_validation_sequence_set = [[FriendlyTeamEventuallyScored()]] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( params=[tbots_cpp.Point(-4.4, 2.9)], setup=setup, inv_eventually_validation_sequence_set=inv_eventually_validation_sequence_set, diff --git a/src/software/ai/hl/stp/play/passing_sim_test.py b/src/software/ai/hl/stp/play/passing_sim_test.py index 6a8693da31..6f7fc6dfda 100644 --- a/src/software/ai/hl/stp/play/passing_sim_test.py +++ b/src/software/ai/hl/stp/play/passing_sim_test.py @@ -1,7 +1,7 @@ import pytest import software.python_bindings as tbots_cpp from proto.import_all_protos import * -from software.simulated_tests.simulated_test_fixture import ( +from software.gameplay_tests.util import ( pytest_main, ) from proto.message_translation.tbots_protobuf import create_world_state @@ -28,7 +28,7 @@ def setup_pass_and_robots( friendly_orientations, enemy_robot_positions, receive_pass, - simulated_test_runner, + gameplay_test_runner, ): """Sets up a test involving 1 robot passing the ball With any number of friendly and enemy robots on the field @@ -40,13 +40,13 @@ def setup_pass_and_robots( :param friendly_orientations: the orientations of the friendly robots :param enemy_robot_positions: the positions of the enemy robots :param receive_pass: whether a friendly robot should try to receive the pass - :param simulated_test_runner: the test runner + :param gameplay_test_runner: the test runner :return: the best pass we generate """ blue_robot_locations = [attacker_robot_position, *receiver_robot_positions] # Setup the world state - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( yellow_robot_locations=enemy_robot_positions, blue_robot_locations=blue_robot_locations, @@ -139,7 +139,7 @@ def setup_pass_and_robots( blue_tactics[1] = ReceiverTactic(**receiver_args) - simulated_test_runner.set_tactics(blue_tactics=blue_tactics, yellow_tactics=None) + gameplay_test_runner.set_tactics(blue_tactics=blue_tactics, yellow_tactics=None) return best_pass @@ -227,7 +227,7 @@ def test_passing_receive_speed( receiver_robot_positions, friendly_orientations, enemy_robot_positions, - simulated_test_runner, + gameplay_test_runner, ): # Eventually Validation eventually_validation_sequence_set = [ @@ -245,7 +245,7 @@ def test_passing_receive_speed( [FriendlyAlwaysReceivesBallSlow(robot_id=1, max_receive_speed=2.1)], ] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=lambda param: setup_pass_and_robots( ball_initial_position=ball_initial_position, ball_initial_velocity=ball_initial_velocity, @@ -253,7 +253,7 @@ def test_passing_receive_speed( receiver_robot_positions=receiver_robot_positions, friendly_orientations=friendly_orientations, enemy_robot_positions=enemy_robot_positions, - simulated_test_runner=simulated_test_runner, + gameplay_test_runner=gameplay_test_runner, receive_pass=True, ), params=[0], @@ -342,7 +342,7 @@ def test_passing_no_backwards_passes( receiver_robot_positions, friendly_orientations, enemy_robot_positions, - simulated_test_runner, + gameplay_test_runner, ): field = tbots_cpp.Field.createSSLDivisionBField() best_pass = setup_pass_and_robots( @@ -353,7 +353,7 @@ def test_passing_no_backwards_passes( friendly_orientations=friendly_orientations, enemy_robot_positions=enemy_robot_positions, receive_pass=True, - simulated_test_runner=simulated_test_runner, + gameplay_test_runner=gameplay_test_runner, ) # Eventually Validation @@ -381,7 +381,7 @@ def test_passing_no_backwards_passes( ], ] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( inv_eventually_validation_sequence_set=eventually_validation_sequence_set, inv_always_validation_sequence_set=always_validation_sequence_set, test_timeout_s=10, diff --git a/src/software/ai/hl/stp/play/penalty_kick_enemy/BUILD b/src/software/ai/hl/stp/play/penalty_kick_enemy/BUILD index 087121e786..99224e202b 100644 --- a/src/software/ai/hl/stp/play/penalty_kick_enemy/BUILD +++ b/src/software/ai/hl/stp/play/penalty_kick_enemy/BUILD @@ -1,4 +1,4 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) diff --git a/src/software/ai/hl/stp/play/penalty_kick_enemy/penalty_kick_enemy_play_test.py b/src/software/ai/hl/stp/play/penalty_kick_enemy/penalty_kick_enemy_play_test.py index af0127a5b8..42756634e3 100644 --- a/src/software/ai/hl/stp/play/penalty_kick_enemy/penalty_kick_enemy_play_test.py +++ b/src/software/ai/hl/stp/play/penalty_kick_enemy/penalty_kick_enemy_play_test.py @@ -16,7 +16,7 @@ from proto.message_translation.tbots_protobuf import create_world_state from proto.import_all_protos import Command from proto.ssl_gc_common_pb2 import Team -from software.simulated_tests.simulated_test_fixture import ( +from software.gameplay_tests.util import ( pytest_main, ) @@ -97,7 +97,7 @@ def test_penalty_kick_enemy_play_setup( friendly_robot_positions, enemy_distance_behind_ball, - simulated_test_runner, + gameplay_test_runner, ): field = tbots_cpp.Field.createSSLDivisionBField() ball_initial_pos = field.enemyPenaltyMark() @@ -126,7 +126,7 @@ def setup(*args): ), ] - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=friendly_robot_positions, yellow_robot_locations=yellow_bots, @@ -135,14 +135,14 @@ def setup(*args): ), ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.HALT, team=Team.UNKNOWN ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.PENALTY, team=Team.YELLOW ) - simulated_test_runner.set_plays( + gameplay_test_runner.set_plays( blue_play=PlayName.PenaltyKickEnemyPlay, yellow_play=PlayName.HaltPlay, ) @@ -171,7 +171,7 @@ def setup(*args): ] ] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_eventually_validation_sequence_set=eventually_validation_sequence_set, ag_eventually_validation_sequence_set=eventually_validation_sequence_set, diff --git a/src/software/ai/hl/stp/play/shoot_or_chip/BUILD b/src/software/ai/hl/stp/play/shoot_or_chip/BUILD index 02f4a51458..a6b275c7f5 100644 --- a/src/software/ai/hl/stp/play/shoot_or_chip/BUILD +++ b/src/software/ai/hl/stp/play/shoot_or_chip/BUILD @@ -1,4 +1,4 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) diff --git a/src/software/ai/hl/stp/play/shoot_or_chip/shoot_or_chip_play_test.py b/src/software/ai/hl/stp/play/shoot_or_chip/shoot_or_chip_play_test.py index 7c07dd531c..322a6fe154 100644 --- a/src/software/ai/hl/stp/play/shoot_or_chip/shoot_or_chip_play_test.py +++ b/src/software/ai/hl/stp/play/shoot_or_chip/shoot_or_chip_play_test.py @@ -3,7 +3,7 @@ import software.python_bindings as tbots_cpp from proto.play_pb2 import PlayName -from software.simulated_tests.simulated_test_fixture import ( +from software.gameplay_tests.util import ( pytest_main, ) from proto.import_all_protos import * @@ -12,7 +12,7 @@ from proto.geometry_pb2 import Point, Vector, Angle, AngularVelocity -def test_shoot_or_chip_play(simulated_test_runner): +def test_shoot_or_chip_play(gameplay_test_runner): def setup(*args): ball_initial_pos = tbots_cpp.Point(-1.4, 2) ball_initial_vel = tbots_cpp.Vector(0, 0) @@ -48,21 +48,21 @@ def setup(*args): world_state.yellow_robots[5].CopyFrom(last_robot) - simulated_test_runner.set_world_state(world_state) + gameplay_test_runner.set_world_state(world_state) - simulated_test_runner.set_plays( + gameplay_test_runner.set_plays( blue_play=PlayName.ShootOrChipPlay, yellow_play=PlayName.HaltPlay ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.STOP, team=Team.UNKNOWN ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.FORCE_START, team=Team.BLUE ) # TODO (#3651): add validations - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_eventually_validation_sequence_set=[[]], ag_eventually_validation_sequence_set=[[]], diff --git a/src/software/ai/hl/stp/play/shoot_or_pass/BUILD b/src/software/ai/hl/stp/play/shoot_or_pass/BUILD index a153f99580..3824dadbdc 100644 --- a/src/software/ai/hl/stp/play/shoot_or_pass/BUILD +++ b/src/software/ai/hl/stp/play/shoot_or_pass/BUILD @@ -1,4 +1,4 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) diff --git a/src/software/ai/hl/stp/play/shoot_or_pass/shoot_or_pass_play_test.py b/src/software/ai/hl/stp/play/shoot_or_pass/shoot_or_pass_play_test.py index 3696893c56..a6dce57a7b 100644 --- a/src/software/ai/hl/stp/play/shoot_or_pass/shoot_or_pass_play_test.py +++ b/src/software/ai/hl/stp/play/shoot_or_pass/shoot_or_pass_play_test.py @@ -8,17 +8,17 @@ from software.gameplay_tests.validation.friendly_team_scored import ( FriendlyTeamEventuallyScored, ) -from software.simulated_tests.simulated_test_fixture import pytest_main +from software.gameplay_tests.util import pytest_main @pytest.mark.skip( "Skipping test. TODO (#3233): attacker robot sometimes doesn't kick the ball towards the receiver" ) -def test_shoot_or_pass_play(simulated_test_runner): +def test_shoot_or_pass_play(gameplay_test_runner): field = tbots_cpp.Field.createSSLDivisionBField() def setup(*args): - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[ field.friendlyGoalCenter(), @@ -41,21 +41,21 @@ def setup(*args): ), ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.STOP, team=Team.UNKNOWN ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.FORCE_START, team=Team.BLUE ) - simulated_test_runner.set_plays( + gameplay_test_runner.set_plays( blue_play=PlayName.ShootOrPassPlay, yellow_play=PlayName.HaltPlay ) # Eventually Validation eventually_validations = [[FriendlyTeamEventuallyScored()]] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_eventually_validation_sequence_set=eventually_validations, ag_eventually_validation_sequence_set=eventually_validations, diff --git a/src/software/ai/hl/stp/play/stop_play_test.py b/src/software/ai/hl/stp/play/stop_play_test.py index 2c7639b48f..3144655f2d 100644 --- a/src/software/ai/hl/stp/play/stop_play_test.py +++ b/src/software/ai/hl/stp/play/stop_play_test.py @@ -12,7 +12,7 @@ RobotNeverEntersRegion, ) from software.gameplay_tests.validation.delay_validation import DelayValidation -from software.simulated_tests.simulated_test_fixture import pytest_main +from software.gameplay_tests.util import pytest_main @pytest.mark.parametrize( @@ -117,11 +117,11 @@ # ), ], ) -def test_stop_play(ball_position, blue_robot_positions, simulated_test_runner): +def test_stop_play(ball_position, blue_robot_positions, gameplay_test_runner): field = tbots_cpp.Field.createSSLDivisionBField() def setup(*args): - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=blue_robot_positions, yellow_robot_locations=[ @@ -137,11 +137,11 @@ def setup(*args): ), ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.STOP, team=Team.UNKNOWN ) - simulated_test_runner.set_plays( + gameplay_test_runner.set_plays( blue_play=PlayName.StopPlay, yellow_play=PlayName.HaltPlay ) @@ -163,7 +163,7 @@ def setup(*args): ] ] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_always_validation_sequence_set=always_stop_play_rules, ag_always_validation_sequence_set=always_stop_play_rules, diff --git a/src/software/ai/hl/stp/tactic/attacker/BUILD b/src/software/ai/hl/stp/tactic/attacker/BUILD index 1c680eed06..8cc99c74ae 100644 --- a/src/software/ai/hl/stp/tactic/attacker/BUILD +++ b/src/software/ai/hl/stp/tactic/attacker/BUILD @@ -1,4 +1,4 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) diff --git a/src/software/ai/hl/stp/tactic/attacker/attacker_tactic_test.py b/src/software/ai/hl/stp/tactic/attacker/attacker_tactic_test.py index 24a372f369..d3340482f4 100644 --- a/src/software/ai/hl/stp/tactic/attacker/attacker_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/attacker/attacker_tactic_test.py @@ -19,7 +19,7 @@ from software.gameplay_tests.validation.robot_at_position import ( RobotEventuallyAtPosition, ) -from software.simulated_tests.simulated_test_fixture import pytest_main +from software.gameplay_tests.util import pytest_main def calculate_ball_velocity(passer_point, receiver_point, speed): @@ -119,10 +119,10 @@ def test_attacker_passing( robot_pos, ball_pos, ball_velocity, - simulated_test_runner, + gameplay_test_runner, ): def setup(*args): - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[ tbots_cpp.Point(-3, 2.5), @@ -140,7 +140,7 @@ def setup(*args): ) ) - simulated_test_runner.set_tactics( + gameplay_test_runner.set_tactics( blue_tactics={ 1: AttackerTactic( best_pass_so_far=Pass( @@ -166,7 +166,7 @@ def setup(*args): ] ] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_eventually_validation_sequence_set=eventually_validation_sequence_set, ag_eventually_validation_sequence_set=eventually_validation_sequence_set, @@ -219,7 +219,7 @@ def test_attacker_keep_away( ball_velocity, enemy_positions, ignore_score_checks, - simulated_test_runner, + gameplay_test_runner, ): # TODO (#3638): Port C++ validation functions that don't exist in Python yet # In C++ test: @@ -241,7 +241,7 @@ def setup(*args): tbots_cpp.Point(-4, 2.75), ] - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[ tbots_cpp.Point(-3, 2.5), @@ -258,7 +258,7 @@ def setup(*args): ) receiver_point = tbots_cpp.Point(0, 0) - simulated_test_runner.set_tactics( + gameplay_test_runner.set_tactics( blue_tactics={ 1: AttackerTactic( best_pass_so_far=Pass( @@ -277,7 +277,7 @@ def setup(*args): ] ] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_always_validation_sequence_set=always_validation_sequence_set, ag_always_validation_sequence_set=always_validation_sequence_set, @@ -348,12 +348,12 @@ def setup(*args): ], ) def test_attacker_shoot_goal( - ball_pos, ball_velocity, robot_pos, enemy_positions, simulated_test_runner + ball_pos, ball_velocity, robot_pos, enemy_positions, gameplay_test_runner ): field = tbots_cpp.Field.createSSLDivisionBField() def setup(*args): - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[robot_pos], yellow_robot_locations=enemy_positions, @@ -362,7 +362,7 @@ def setup(*args): ) ) - simulated_test_runner.set_tactics( + gameplay_test_runner.set_tactics( blue_tactics={ 0: AttackerTactic( chip_target=tbots_cpp.createPointProto( @@ -378,7 +378,7 @@ def setup(*args): ] ] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_eventually_validation_sequence_set=eventually_validation_sequence_set, ag_eventually_validation_sequence_set=eventually_validation_sequence_set, diff --git a/src/software/ai/hl/stp/tactic/chip/BUILD b/src/software/ai/hl/stp/tactic/chip/BUILD index 4dccbbe6c4..a7bc7ba44e 100644 --- a/src/software/ai/hl/stp/tactic/chip/BUILD +++ b/src/software/ai/hl/stp/tactic/chip/BUILD @@ -1,4 +1,4 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) diff --git a/src/software/ai/hl/stp/tactic/chip/chip_tactic_test.py b/src/software/ai/hl/stp/tactic/chip/chip_tactic_test.py index 529acea570..cc03adfd4e 100644 --- a/src/software/ai/hl/stp/tactic/chip/chip_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/chip/chip_tactic_test.py @@ -9,7 +9,7 @@ from software.gameplay_tests.validation.ball_kicked_in_direction import ( BallEventuallyKickedInDirection, ) -from software.simulated_tests.simulated_test_fixture import ( +from software.gameplay_tests.util import ( pytest_main, ) from proto.message_translation.tbots_protobuf import create_world_state @@ -48,12 +48,12 @@ ), ], ) -def test_chip(ball_offset_from_robot, angle_to_chip_at, simulated_test_runner): +def test_chip(ball_offset_from_robot, angle_to_chip_at, gameplay_test_runner): robot_position = tbots_cpp.Point(0, 0) ball_position = robot_position + ball_offset_from_robot def setup(*args): - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[ tbots_cpp.Point(-3, 2.5), @@ -65,7 +65,7 @@ def setup(*args): ) ) - simulated_test_runner.set_tactics( + gameplay_test_runner.set_tactics( blue_tactics={ 1: ChipTactic( chip_origin=tbots_cpp.createPointProto(ball_position), @@ -84,7 +84,7 @@ def setup(*args): ], ] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_eventually_validation_sequence_set=eventually_validations, ag_eventually_validation_sequence_set=eventually_validations, diff --git a/src/software/ai/hl/stp/tactic/crease_defender/BUILD b/src/software/ai/hl/stp/tactic/crease_defender/BUILD index b2cd797b85..d7c2814986 100644 --- a/src/software/ai/hl/stp/tactic/crease_defender/BUILD +++ b/src/software/ai/hl/stp/tactic/crease_defender/BUILD @@ -1,4 +1,4 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) diff --git a/src/software/ai/hl/stp/tactic/crease_defender/crease_defender_tactic_test.py b/src/software/ai/hl/stp/tactic/crease_defender/crease_defender_tactic_test.py index 66ce091748..68c78c8a54 100644 --- a/src/software/ai/hl/stp/tactic/crease_defender/crease_defender_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/crease_defender/crease_defender_tactic_test.py @@ -23,16 +23,16 @@ RobotEventuallyEntersRegion, RobotNeverEntersRegion, ) -from software.simulated_tests.simulated_test_fixture import ( +from software.gameplay_tests.util import ( pytest_main, ) -def test_not_bumping_ball_towards_net(simulated_test_runner): +def test_not_bumping_ball_towards_net(gameplay_test_runner): enemy_threat_point = tbots_cpp.Point(3, 0) def setup(*args): - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[tbots_cpp.Point(0, 0)], yellow_robot_locations=[tbots_cpp.Point(4, 0)], @@ -41,7 +41,7 @@ def setup(*args): ) ) - simulated_test_runner.set_tactics( + gameplay_test_runner.set_tactics( blue_tactics={ 0: CreaseDefenderTactic( enemy_threat_origin=tbots_cpp.createPointProto(enemy_threat_point), @@ -52,7 +52,7 @@ def setup(*args): always_validations = [[BallSpeedAlwaysBelowThreshold(0.001)]] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_always_validation_sequence_set=always_validations, ag_always_validation_sequence_set=always_validations, @@ -79,12 +79,12 @@ def setup(*args): ], ) def test_crease_region_positioning( - enemy_threat_point, crease_alignment, region_index, simulated_test_runner + enemy_threat_point, crease_alignment, region_index, gameplay_test_runner ): field = tbots_cpp.Field.createSSLDivisionBField() def setup(*args): - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[tbots_cpp.Point(-3, 1.5)], yellow_robot_locations=[ @@ -100,7 +100,7 @@ def setup(*args): ) ) - simulated_test_runner.set_tactics( + gameplay_test_runner.set_tactics( blue_tactics={ 0: CreaseDefenderTactic( enemy_threat_origin=tbots_cpp.createPointProto(enemy_threat_point), @@ -174,7 +174,7 @@ def setup(*args): ] ] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_eventually_validation_sequence_set=eventually_validations, ag_eventually_validation_sequence_set=eventually_validations, @@ -211,10 +211,10 @@ def test_crease_positioning( yellow_bots, ball_initial_pos, ball_initial_velocity, - simulated_test_runner, + gameplay_test_runner, ): def setup(*args): - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[blue_bots], yellow_robot_locations=[yellow_bots], @@ -223,7 +223,7 @@ def setup(*args): ) ) - simulated_test_runner.set_tactics( + gameplay_test_runner.set_tactics( blue_tactics={ 0: CreaseDefenderTactic( enemy_threat_origin=tbots_cpp.createPointProto(ball_initial_pos), @@ -259,7 +259,7 @@ def setup(*args): ] ] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_eventually_validation_sequence_set=eventually_validation_sequence_set, inv_always_validation_sequence_set=always_validation_sequence_set, @@ -321,10 +321,10 @@ def test_crease_autochip( ball_initial_pos, ball_initial_velocity, should_chip, - simulated_test_runner, + gameplay_test_runner, ): def setup(*args): - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[blue_bots], yellow_robot_locations=[yellow_bots], @@ -333,7 +333,7 @@ def setup(*args): ) ) - simulated_test_runner.set_tactics( + gameplay_test_runner.set_tactics( blue_tactics={ 0: CreaseDefenderTactic( enemy_threat_origin=tbots_cpp.createPointProto(ball_initial_pos), @@ -356,7 +356,7 @@ def setup(*args): always_validation_sequence_set = [[]] eventually_validation_sequence_set = [[BallIsEventuallyOffGround()]] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_eventually_validation_sequence_set=eventually_validation_sequence_set, inv_always_validation_sequence_set=always_validation_sequence_set, @@ -393,10 +393,10 @@ def test_crease_get_ball( ball_initial_pos, ball_initial_velocity, should_dribble, - simulated_test_runner, + gameplay_test_runner, ): def setup(*args): - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[blue_bots], yellow_robot_locations=[yellow_bots], @@ -405,7 +405,7 @@ def setup(*args): ) ) - simulated_test_runner.set_tactics( + gameplay_test_runner.set_tactics( blue_tactics={ 0: CreaseDefenderTactic( enemy_threat_origin=tbots_cpp.createPointProto(ball_initial_pos), @@ -437,7 +437,7 @@ def setup(*args): RobotNeverEntersRegion(regions=[tbots_cpp.Circle(ball_initial_pos, 0.2)]) ) - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_eventually_validation_sequence_set=eventually_validation_sequence_set, inv_always_validation_sequence_set=always_validation_sequence_set, diff --git a/src/software/ai/hl/stp/tactic/defender/BUILD b/src/software/ai/hl/stp/tactic/defender/BUILD index 7c0610ce93..f4bedf6d73 100644 --- a/src/software/ai/hl/stp/tactic/defender/BUILD +++ b/src/software/ai/hl/stp/tactic/defender/BUILD @@ -1,4 +1,4 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) diff --git a/src/software/ai/hl/stp/tactic/dribble/BUILD b/src/software/ai/hl/stp/tactic/dribble/BUILD index d696b5657e..b4387617cd 100644 --- a/src/software/ai/hl/stp/tactic/dribble/BUILD +++ b/src/software/ai/hl/stp/tactic/dribble/BUILD @@ -1,4 +1,4 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) diff --git a/src/software/ai/hl/stp/tactic/dribble/dribble_tactic_test.py b/src/software/ai/hl/stp/tactic/dribble/dribble_tactic_test.py index 6be8d842d7..df27e73193 100644 --- a/src/software/ai/hl/stp/tactic/dribble/dribble_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/dribble/dribble_tactic_test.py @@ -21,7 +21,7 @@ from software.gameplay_tests.validation.delay_validation import ( DelayValidation, ) -from software.simulated_tests.simulated_test_fixture import ( +from software.gameplay_tests.util import ( pytest_main, ) @@ -129,10 +129,10 @@ def test_dribble( dribble_orientation, ball_pos, ball_vel, - simulated_test_runner, + gameplay_test_runner, ): def setup(*args): - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[ tbots_cpp.Point(-3, 2.5), @@ -156,7 +156,7 @@ def setup(*args): tbots_cpp.createAngleProto(dribble_orientation) ) - simulated_test_runner.set_tactics(blue_tactics={1: dribble_params}) + gameplay_test_runner.set_tactics(blue_tactics={1: dribble_params}) eventually_validations = [[RobotEventuallyReceivedBall(robot_id=1)]] @@ -177,7 +177,7 @@ def setup(*args): # TODO (#2514): tune dribbling and re-enable # Robot always not excessively dribbling - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_eventually_validation_sequence_set=eventually_validations, ag_eventually_validation_sequence_set=eventually_validations, @@ -296,11 +296,11 @@ def test_excessive_dribbling_without_enemies( dribble_destination, final_dribble_orientation, should_excessively_dribble, - simulated_test_runner, + gameplay_test_runner, blue_robot_location, ): def setup(*args): - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[blue_robot_location], yellow_robot_locations=[], @@ -309,7 +309,7 @@ def setup(*args): ) ) - simulated_test_runner.set_tactics( + gameplay_test_runner.set_tactics( blue_tactics={ 0: DribbleTactic( dribble_destination=tbots_cpp.createPointProto(dribble_destination), @@ -330,7 +330,7 @@ def setup(*args): always_validation_sequence_set = [[NeverExcessivelyDribbles()]] eventually_validation_sequence_set = [[]] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_eventually_validation_sequence_set=eventually_validation_sequence_set, inv_always_validation_sequence_set=always_validation_sequence_set, @@ -339,13 +339,13 @@ def setup(*args): ) -def test_dribble_with_excessive_dribbling(simulated_test_runner): +def test_dribble_with_excessive_dribbling(gameplay_test_runner): dribble_destination = tbots_cpp.Point(3, 2) initial_position = tbots_cpp.Point(4.5, -3.0) dribble_orientation = tbots_cpp.Angle.half() def setup(*args): - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[ tbots_cpp.Point(-3, 2.5), @@ -357,7 +357,7 @@ def setup(*args): ) ) - simulated_test_runner.set_tactics( + gameplay_test_runner.set_tactics( blue_tactics={ 1: DribbleTactic( dribble_destination=tbots_cpp.createPointProto(dribble_destination), @@ -378,7 +378,7 @@ def setup(*args): [EventuallyStartsExcessivelyDribbling()], ] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_eventually_validation_sequence_set=eventually_validation_sequence_set, ag_eventually_validation_sequence_set=eventually_validation_sequence_set, @@ -387,7 +387,7 @@ def setup(*args): def test_run_into_enemy_robot_knock_ball_away( - simulated_test_runner, + gameplay_test_runner, ): initial_position = tbots_cpp.Point(-2, 1.5) dribble_destination = tbots_cpp.Point(-1, 2) @@ -396,7 +396,7 @@ def test_run_into_enemy_robot_knock_ball_away( ball_vel = tbots_cpp.Vector(2, 4) def setup(*args): - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[ tbots_cpp.Point(-3, 2.5), @@ -415,7 +415,7 @@ def setup(*args): final_dribble_orientation=tbots_cpp.createAngleProto(dribble_orientation), ) - simulated_test_runner.set_tactics(blue_tactics={1: dribble_params}) + gameplay_test_runner.set_tactics(blue_tactics={1: dribble_params}) eventually_validations = [ [ @@ -429,7 +429,7 @@ def setup(*args): # TODO (#2514): tune dribbling and re-enable # Robot always not excessively dribbling - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_eventually_validation_sequence_set=eventually_validations, ag_eventually_validation_sequence_set=eventually_validations, @@ -438,7 +438,7 @@ def setup(*args): def test_robot_not_bumping_ball_when_turning( - simulated_test_runner, + gameplay_test_runner, ): # The ball is placed right behind the friendly robot. Verify that the robot # does not bump the ball away when turning around to dribble it. @@ -446,7 +446,7 @@ def test_robot_not_bumping_ball_when_turning( ball_location = robot_location + tbots_cpp.Vector(ROBOT_MAX_RADIUS_METERS, 0) def setup(*args): - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[tbots_cpp.Point(-3, 2.5), robot_location], blue_robot_orientations=[ @@ -461,7 +461,7 @@ def setup(*args): ) dribble_params = DribbleTactic() - simulated_test_runner.set_tactics(blue_tactics={1: dribble_params}) + gameplay_test_runner.set_tactics(blue_tactics={1: dribble_params}) eventually_validations = [ [ @@ -475,7 +475,7 @@ def setup(*args): [BallAlwaysStaysInRegion([tbots_cpp.Circle(ball_location, 0.05)])] ] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_eventually_validation_sequence_set=eventually_validations, ag_eventually_validation_sequence_set=eventually_validations, diff --git a/src/software/ai/hl/stp/tactic/goalie/BUILD b/src/software/ai/hl/stp/tactic/goalie/BUILD index 21d6e04514..ffc112a166 100644 --- a/src/software/ai/hl/stp/tactic/goalie/BUILD +++ b/src/software/ai/hl/stp/tactic/goalie/BUILD @@ -1,4 +1,4 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) diff --git a/src/software/ai/hl/stp/tactic/goalie/goalie_tactic_test.py b/src/software/ai/hl/stp/tactic/goalie/goalie_tactic_test.py index 369a4a1f9c..4633122fb0 100644 --- a/src/software/ai/hl/stp/tactic/goalie/goalie_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/goalie/goalie_tactic_test.py @@ -9,7 +9,7 @@ from software.gameplay_tests.validation.ball_speed_threshold import * from software.gameplay_tests.validation.robot_speed_threshold import * from software.gameplay_tests.validation.excessive_dribbling import * -from software.simulated_tests.simulated_test_fixture import ( +from software.gameplay_tests.util import ( pytest_main, ) from proto.message_translation.tbots_protobuf import create_world_state @@ -112,10 +112,10 @@ def test_goalie_blocks_shot( ball_initial_position, ball_initial_velocity, robot_initial_position, - simulated_test_runner, + gameplay_test_runner, ): def setup(*args): - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( [], blue_robot_locations=[robot_initial_position], @@ -124,7 +124,7 @@ def setup(*args): ) ) - simulated_test_runner.set_tactics( + gameplay_test_runner.set_tactics( blue_tactics={ 0: GoalieTactic( max_allowed_speed_mode=MaxAllowedSpeedMode.PHYSICAL_LIMIT @@ -155,7 +155,7 @@ def setup(*args): ] ] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_eventually_validation_sequence_set=eventually_validation_sequence_set, inv_always_validation_sequence_set=always_validation_sequence_set, @@ -189,10 +189,10 @@ def setup(*args): def test_goalie_clears_from_dead_zone( ball_position, should_clear, - simulated_test_runner, + gameplay_test_runner, ): def setup(*args): - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( [], blue_robot_locations=[ @@ -205,7 +205,7 @@ def setup(*args): ) ) - simulated_test_runner.set_tactics( + gameplay_test_runner.set_tactics( blue_tactics={ 0: GoalieTactic( max_allowed_speed_mode=MaxAllowedSpeedMode.PHYSICAL_LIMIT @@ -238,7 +238,7 @@ def setup(*args): ] ] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, test_timeout_s=8, inv_eventually_validation_sequence_set=eventually_validation_sequence_set, diff --git a/src/software/ai/hl/stp/tactic/halt/BUILD b/src/software/ai/hl/stp/tactic/halt/BUILD index 53ae62a187..ac0a3f05e3 100644 --- a/src/software/ai/hl/stp/tactic/halt/BUILD +++ b/src/software/ai/hl/stp/tactic/halt/BUILD @@ -1,4 +1,4 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) diff --git a/src/software/ai/hl/stp/tactic/halt/halt_tactic_test.py b/src/software/ai/hl/stp/tactic/halt/halt_tactic_test.py index 018615a643..9217b725f3 100644 --- a/src/software/ai/hl/stp/tactic/halt/halt_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/halt/halt_tactic_test.py @@ -9,7 +9,7 @@ RobotSpeedEventuallyBelowThreshold, ) from software.gameplay_tests.validation.delay_validation import DelayValidation -from software.simulated_tests.simulated_test_fixture import ( +from software.gameplay_tests.util import ( pytest_main, ) @@ -31,9 +31,9 @@ ), ], ) -def test_robot_halt(blue_robot_locations, blue_robot_velocities, simulated_test_runner): +def test_robot_halt(blue_robot_locations, blue_robot_velocities, gameplay_test_runner): def setup(*args): - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=blue_robot_locations, blue_robot_velocities=blue_robot_velocities, @@ -43,7 +43,7 @@ def setup(*args): ) ) - simulated_test_runner.set_tactics(blue_tactics={1: HaltTactic()}) + gameplay_test_runner.set_tactics(blue_tactics={1: HaltTactic()}) robot_stopped_validation = RobotSpeedEventuallyBelowThreshold(speed_threshold=0.001) @@ -61,7 +61,7 @@ def setup(*args): ] ] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_eventually_validation_sequence_set=eventually_validations, ag_eventually_validation_sequence_set=eventually_validations, diff --git a/src/software/ai/hl/stp/tactic/kick/BUILD b/src/software/ai/hl/stp/tactic/kick/BUILD index 7755889e0c..b8569fc5bc 100644 --- a/src/software/ai/hl/stp/tactic/kick/BUILD +++ b/src/software/ai/hl/stp/tactic/kick/BUILD @@ -1,4 +1,4 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) diff --git a/src/software/ai/hl/stp/tactic/kick/kick_tactic_test.py b/src/software/ai/hl/stp/tactic/kick/kick_tactic_test.py index 6ae25e19bc..3c9cdebbfa 100644 --- a/src/software/ai/hl/stp/tactic/kick/kick_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/kick/kick_tactic_test.py @@ -7,7 +7,7 @@ from software.gameplay_tests.validation.ball_kicked_in_direction import ( BallEventuallyKickedInDirection, ) -from software.simulated_tests.simulated_test_fixture import ( +from software.gameplay_tests.util import ( pytest_main, ) @@ -38,12 +38,12 @@ (tbots_cpp.Vector(ROBOT_MAX_RADIUS_METERS, 0), tbots_cpp.Angle.zero()), ], ) -def test_kick(ball_offset_from_robot, angle_to_kick_at, simulated_test_runner): +def test_kick(ball_offset_from_robot, angle_to_kick_at, gameplay_test_runner): robot_position = tbots_cpp.Point(0, 0) ball_position = robot_position + ball_offset_from_robot def setup(*args): - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[ tbots_cpp.Point(-3, 2.5), @@ -55,7 +55,7 @@ def setup(*args): ) ) - simulated_test_runner.set_tactics( + gameplay_test_runner.set_tactics( blue_tactics={ 1: KickTactic( kick_origin=tbots_cpp.createPointProto(ball_position), @@ -71,7 +71,7 @@ def setup(*args): ] ] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_eventually_validation_sequence_set=eventually_validations, ag_eventually_validation_sequence_set=eventually_validations, diff --git a/src/software/ai/hl/stp/tactic/move/BUILD b/src/software/ai/hl/stp/tactic/move/BUILD index 7f0a827dc7..5ee4f5f696 100644 --- a/src/software/ai/hl/stp/tactic/move/BUILD +++ b/src/software/ai/hl/stp/tactic/move/BUILD @@ -1,4 +1,4 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) diff --git a/src/software/ai/hl/stp/tactic/move/move_tactic_test.py b/src/software/ai/hl/stp/tactic/move/move_tactic_test.py index fe785c36db..bfbb56ce8d 100644 --- a/src/software/ai/hl/stp/tactic/move/move_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/move/move_tactic_test.py @@ -18,7 +18,7 @@ ) from software.gameplay_tests.validation.duration_validation import DurationValidation -# from software.simulated_tests.simulated_test_fixture import ( +# from software.gameplay_tests.util import ( # pytest_main, # ) from software.gameplay_tests.util import ( @@ -81,13 +81,13 @@ def setup(*args): ) -# def test_autochip_move(simulated_test_runner): +# def test_autochip_move(gameplay_test_runner): # initial_position = tbots_cpp.Point(-3, 1.5) # destination = tbots_cpp.Point(0, 1.5) # field = tbots_cpp.Field.createSSLDivisionBField() # # def setup(*args): -# simulated_test_runner.set_world_state( +# gameplay_test_runner.set_world_state( # create_world_state( # blue_robot_locations=[ # tbots_cpp.Point(-3, 2.5), @@ -106,7 +106,7 @@ def setup(*args): # ), # ) # -# simulated_test_runner.set_tactics( +# gameplay_test_runner.set_tactics( # blue_tactics={ # 1: MoveTactic( # destination=tbots_cpp.createPointProto(destination), @@ -135,7 +135,7 @@ def setup(*args): # ] # ] # -# simulated_test_runner.run_test( +# gameplay_test_runner.run_test( # setup=setup, # inv_eventually_validation_sequence_set=eventually_validation_sequence_set, # ag_eventually_validation_sequence_set=eventually_validation_sequence_set, @@ -143,13 +143,13 @@ def setup(*args): # ) # # -# def test_autokick_move(simulated_test_runner): +# def test_autokick_move(gameplay_test_runner): # initial_position = tbots_cpp.Point(-1, -0.5) # destination = tbots_cpp.Point(-1, -1) # field = tbots_cpp.Field.createSSLDivisionBField() # # def setup(*args): -# simulated_test_runner.set_world_state( +# gameplay_test_runner.set_world_state( # create_world_state( # blue_robot_locations=[initial_position], # blue_robot_orientations=[tbots_cpp.Angle.threeQuarter()], @@ -166,7 +166,7 @@ def setup(*args): # ), # ) # -# simulated_test_runner.set_tactics( +# gameplay_test_runner.set_tactics( # blue_tactics={ # 0: MoveTactic( # destination=tbots_cpp.createPointProto(destination), @@ -194,7 +194,7 @@ def setup(*args): # ] # ] # -# simulated_test_runner.run_test( +# gameplay_test_runner.run_test( # setup=setup, # inv_eventually_validation_sequence_set=eventually_validation_sequence_set, # ag_eventually_validation_sequence_set=eventually_validation_sequence_set, @@ -250,10 +250,10 @@ def setup(*args): # ], # ) # def test_spinning_move( -# orientation, initial_position, destination, angular_velocity, simulated_test_runner +# orientation, initial_position, destination, angular_velocity, gameplay_test_runner # ): # def setup(*args): -# simulated_test_runner.set_world_state( +# gameplay_test_runner.set_world_state( # create_world_state( # blue_robot_locations=[initial_position], # yellow_robot_locations=[tbots_cpp.Point(4, 0)], @@ -262,7 +262,7 @@ def setup(*args): # ), # ) # -# simulated_test_runner.set_tactics( +# gameplay_test_runner.set_tactics( # blue_tactics={ # 0: MoveTactic( # destination=tbots_cpp.createPointProto(destination), @@ -294,7 +294,7 @@ def setup(*args): # ], # ] # -# simulated_test_runner.run_test( +# gameplay_test_runner.run_test( # setup=setup, # inv_eventually_validation_sequence_set=eventually_validation_sequence_set, # ag_eventually_validation_sequence_set=eventually_validation_sequence_set, diff --git a/src/software/ai/hl/stp/tactic/pass_defender/BUILD b/src/software/ai/hl/stp/tactic/pass_defender/BUILD index 83d729c3c7..e1702deea4 100644 --- a/src/software/ai/hl/stp/tactic/pass_defender/BUILD +++ b/src/software/ai/hl/stp/tactic/pass_defender/BUILD @@ -1,4 +1,4 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) diff --git a/src/software/ai/hl/stp/tactic/pass_defender/pass_defender_tactic_test.py b/src/software/ai/hl/stp/tactic/pass_defender/pass_defender_tactic_test.py index b1f349a3a8..7e2191a3bc 100644 --- a/src/software/ai/hl/stp/tactic/pass_defender/pass_defender_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/pass_defender/pass_defender_tactic_test.py @@ -9,7 +9,7 @@ from software.gameplay_tests.validation.ball_speed_threshold import * from software.gameplay_tests.validation.robot_speed_threshold import * from software.gameplay_tests.validation.excessive_dribbling import * -from software.simulated_tests.simulated_test_fixture import ( +from software.gameplay_tests.util import ( pytest_main, ) from proto.message_translation.tbots_protobuf import create_world_state @@ -34,10 +34,10 @@ def test_ball_chipped_on_intercept( ball_initial_position, ball_initial_velocity, position_to_block_from, - simulated_test_runner, + gameplay_test_runner, ): def setup(*args): - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( [], blue_robot_locations=[position_to_block_from], @@ -46,7 +46,7 @@ def setup(*args): ) ) - simulated_test_runner.set_tactics( + gameplay_test_runner.set_tactics( blue_tactics={ 0: PassDefenderTactic( position_to_block_from=tbots_cpp.createPointProto( @@ -73,7 +73,7 @@ def setup(*args): eventually_validation_sequence_set = [[BallSpeedEventuallyBelowThreshold(0.4)]] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_eventually_validation_sequence_set=eventually_validation_sequence_set, inv_always_validation_sequence_set=always_validation_sequence_set, @@ -107,10 +107,10 @@ def test_avoid_intercept_scenario( ball_initial_position, ball_initial_velocity, position_to_block_from, - simulated_test_runner, + gameplay_test_runner, ): def setup(*args): - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( [], blue_robot_locations=[position_to_block_from], @@ -119,7 +119,7 @@ def setup(*args): ) ) - simulated_test_runner.set_tactics( + gameplay_test_runner.set_tactics( blue_tactics={ 0: PassDefenderTactic( position_to_block_from=tbots_cpp.createPointProto( @@ -164,7 +164,7 @@ def setup(*args): eventually_validation_sequence_set = [[BallSpeedEventuallyBelowThreshold(0.4)]] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_eventually_validation_sequence_set=eventually_validation_sequence_set, inv_always_validation_sequence_set=always_validation_sequence_set, @@ -240,10 +240,10 @@ def test_steal_ball( position_to_block_from, enemy_kicker_position, should_steal, - simulated_test_runner, + gameplay_test_runner, ): def setup(*args): - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[position_to_block_from], yellow_robot_locations=[enemy_kicker_position], @@ -252,7 +252,7 @@ def setup(*args): ) ) - simulated_test_runner.set_tactics( + gameplay_test_runner.set_tactics( blue_tactics={ 0: PassDefenderTactic( position_to_block_from=tbots_cpp.createPointProto( @@ -285,7 +285,7 @@ def setup(*args): FriendlyNeverHasBallPossession(tolerance=0.05) ) - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_eventually_validation_sequence_set=eventually_validation_sequence_set, inv_always_validation_sequence_set=always_validation_sequence_set, diff --git a/src/software/ai/hl/stp/tactic/penalty_kick/BUILD b/src/software/ai/hl/stp/tactic/penalty_kick/BUILD index c1d0b66b48..63a217f74e 100644 --- a/src/software/ai/hl/stp/tactic/penalty_kick/BUILD +++ b/src/software/ai/hl/stp/tactic/penalty_kick/BUILD @@ -1,4 +1,4 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) diff --git a/src/software/ai/hl/stp/tactic/penalty_kick/penalty_kick_tactic_test.py b/src/software/ai/hl/stp/tactic/penalty_kick/penalty_kick_tactic_test.py index 9eb9c58321..82ea9b42bb 100644 --- a/src/software/ai/hl/stp/tactic/penalty_kick/penalty_kick_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/penalty_kick/penalty_kick_tactic_test.py @@ -13,7 +13,7 @@ BallAlwaysMovesForward, ) from proto.message_translation.tbots_protobuf import create_world_state -from software.simulated_tests.simulated_test_fixture import ( +from software.gameplay_tests.util import ( pytest_main, ) @@ -52,7 +52,7 @@ "Disabling this test because of poor dribbling controls, does not consistently score goal. TODO (#2232)" ) def test_penalty_kick( - enemy_robot_location, enemy_robot_velocity, simulated_test_runner + enemy_robot_location, enemy_robot_velocity, gameplay_test_runner ): field = tbots_cpp.Field.createSSLDivisionBField() ball_initial_pos = field.friendlyPenaltyMark() @@ -60,7 +60,7 @@ def test_penalty_kick( def setup(*args): shooter_position = ball_initial_pos - tbots_cpp.Vector(0.1, 0) - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[shooter_position], yellow_robot_locations=[enemy_robot_location], @@ -69,7 +69,7 @@ def setup(*args): ), ) - simulated_test_runner.set_tactics(blue_tactics={0: PenaltyKickTactic()}) + gameplay_test_runner.set_tactics(blue_tactics={0: PenaltyKickTactic()}) eventually_validation_sequence_set = [ [ @@ -82,7 +82,7 @@ def setup(*args): [BallAlwaysMovesForward(ball_initial_pos), NeverExcessivelyDribbles()] ] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_eventually_validation_sequence_set=eventually_validation_sequence_set, inv_always_validation_sequence_set=always_validation_sequence_set, diff --git a/src/software/ai/hl/stp/tactic/pivot_kick/BUILD b/src/software/ai/hl/stp/tactic/pivot_kick/BUILD index fca43ba8ed..985381803d 100644 --- a/src/software/ai/hl/stp/tactic/pivot_kick/BUILD +++ b/src/software/ai/hl/stp/tactic/pivot_kick/BUILD @@ -1,4 +1,4 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) diff --git a/src/software/ai/hl/stp/tactic/pivot_kick/pivot_kick_tactic_test.py b/src/software/ai/hl/stp/tactic/pivot_kick/pivot_kick_tactic_test.py index 75c4c0fde9..fa543d4346 100644 --- a/src/software/ai/hl/stp/tactic/pivot_kick/pivot_kick_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/pivot_kick/pivot_kick_tactic_test.py @@ -7,7 +7,7 @@ from software.gameplay_tests.validation.ball_kicked_in_direction import ( BallEventuallyKickedInDirection, ) -from software.simulated_tests.simulated_test_fixture import ( +from software.gameplay_tests.util import ( pytest_main, ) @@ -36,12 +36,12 @@ @pytest.mark.skip( "Disabling this flaky test. TODO (#2859): the robot does not dribble far enough into the ball" ) -def test_pivot_kick(ball_offset_from_robot, angle_to_kick_at, simulated_test_runner): +def test_pivot_kick(ball_offset_from_robot, angle_to_kick_at, gameplay_test_runner): robot_position = tbots_cpp.Point(0, 0) ball_position = robot_position + ball_offset_from_robot def setup(*args): - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[ tbots_cpp.Point(-3, 2.5), @@ -53,7 +53,7 @@ def setup(*args): ) ) - simulated_test_runner.set_tactics( + gameplay_test_runner.set_tactics( blue_tactics={ 1: PivotKickTactic( kick_origin=tbots_cpp.createPointProto(ball_position), @@ -69,7 +69,7 @@ def setup(*args): ] ] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_eventually_validation_sequence_set=eventually_validation_sequence_set, inv_always_validation_sequence_set=[[]], diff --git a/src/software/ai/hl/stp/tactic/receiver/BUILD b/src/software/ai/hl/stp/tactic/receiver/BUILD index 0f4112fd93..877ca871cb 100644 --- a/src/software/ai/hl/stp/tactic/receiver/BUILD +++ b/src/software/ai/hl/stp/tactic/receiver/BUILD @@ -1,4 +1,4 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) diff --git a/src/software/ai/hl/stp/tactic/receiver/receiver_tactic_test.py b/src/software/ai/hl/stp/tactic/receiver/receiver_tactic_test.py index 759a7a3a5c..3bd745b2e0 100644 --- a/src/software/ai/hl/stp/tactic/receiver/receiver_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/receiver/receiver_tactic_test.py @@ -12,7 +12,7 @@ from software.gameplay_tests.validation.robot_received_ball import ( RobotEventuallyReceivedBall, ) -from software.simulated_tests.simulated_test_fixture import pytest_main +from software.gameplay_tests.util import pytest_main def calculate_ball_velocity(passer_point, receiver_point, speed): @@ -187,14 +187,14 @@ def test_receiver( robot_pos, robot_orientation, one_touch, - simulated_test_runner, + gameplay_test_runner, ): def setup(*args): ball_velocity = calculate_ball_velocity( passer_point, receiver_point, pass_speed ) - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[ tbots_cpp.Point(-3, 2.5), @@ -216,7 +216,7 @@ def setup(*args): "disable_one_touch_shot": not one_touch, } - simulated_test_runner.set_tactics( + gameplay_test_runner.set_tactics( blue_tactics={1: ReceiverTactic(**receiver_args)} ) @@ -232,7 +232,7 @@ def setup(*args): ] ] - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, inv_eventually_validation_sequence_set=eventually_validation_sequence_set, ag_eventually_validation_sequence_set=eventually_validation_sequence_set, diff --git a/src/software/ai/hl/stp/tactic/shadow_enemy/BUILD b/src/software/ai/hl/stp/tactic/shadow_enemy/BUILD index a56ba5e49d..078ebe5b3e 100644 --- a/src/software/ai/hl/stp/tactic/shadow_enemy/BUILD +++ b/src/software/ai/hl/stp/tactic/shadow_enemy/BUILD @@ -1,4 +1,4 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) diff --git a/src/software/ai/navigator/trajectory/BUILD b/src/software/ai/navigator/trajectory/BUILD index c3dc62daa6..aed39a7737 100644 --- a/src/software/ai/navigator/trajectory/BUILD +++ b/src/software/ai/navigator/trajectory/BUILD @@ -1,8 +1,8 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = [ "//software/ai:__subpackages__", - "//software/simulated_tests:__subpackages__", + "//software/gameplay_tests:__subpackages__", ]) cc_library( diff --git a/src/software/ai/navigator/trajectory/simulated_hrvo_test.py b/src/software/ai/navigator/trajectory/simulated_hrvo_test.py index 39f6e11d3e..502abe50de 100644 --- a/src/software/ai/navigator/trajectory/simulated_hrvo_test.py +++ b/src/software/ai/navigator/trajectory/simulated_hrvo_test.py @@ -1,5 +1,5 @@ import pytest -from software.simulated_tests.simulated_test_fixture import ( +from software.gameplay_tests.util import ( pytest_main, ) from software.gameplay_tests.validation.avoid_collisions import * @@ -9,7 +9,7 @@ import math from proto.import_all_protos import * from proto.ssl_gc_common_pb2 import Team -from software.simulated_tests.simulated_test_fixture import SimulatedTestRunner +from software.gameplay_tests.util import SimulatedTestRunner from software.gameplay_tests.validation.validation import ( create_validation_types, create_validation_geometry, @@ -168,7 +168,7 @@ def hrvo_setup( friendly_robots_final_orientations: list[tbots.Angle], enemy_robots_positions: list[tbots.Point], enemy_robots_destinations: list[tbots.Point], - simulated_test_runner: SimulatedTestRunner, + gameplay_test_runner: SimulatedTestRunner, ): """Setup for the hrvo tests @@ -177,7 +177,7 @@ def hrvo_setup( :param friendly_robots_final_orientations: final orientations of friendly robots :param enemy_robots_positions: starting positions of enemy robots :param enemy_robots_destinations: destinations of enemy robots - :param simulated_test_runner: the current test runner being used + :param gameplay_test_runner: the current test runner being used """ desired_orientation = tbots.Angle.fromRadians(0) @@ -185,7 +185,7 @@ def hrvo_setup( ball_initial_vel = tbots.Point(0, 0) - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( yellow_robot_locations=enemy_robots_positions, blue_robot_locations=friendly_robots_positions, @@ -194,13 +194,13 @@ def hrvo_setup( ) ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.STOP, team=Team.BLUE ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.STOP, team=Team.YELLOW ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.FORCE_START, team=Team.BLUE ) @@ -226,7 +226,7 @@ def hrvo_setup( tbots.Angle.fromRadians(0), ) - simulated_test_runner.set_tactics( + gameplay_test_runner.set_tactics( blue_tactics=blue_tactics, yellow_tactics=yellow_tactics ) @@ -472,7 +472,7 @@ def hrvo_setup( ], ) def test_robot_movement( - simulated_test_runner: SimulatedTestRunner, + gameplay_test_runner: SimulatedTestRunner, friendly_robot_positions: list[tbots.Point], friendly_robot_destinations: list[tbots.Point], friendly_robots_final_orientations: list[tbots.Angle], @@ -491,14 +491,14 @@ def test_robot_movement( else get_reached_destination_validation(friendly_robot_destinations) ) - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=lambda param: hrvo_setup( friendly_robot_positions, friendly_robot_destinations, friendly_robots_final_orientations, enemy_robots_positions, enemy_robots_destinations, - simulated_test_runner, + gameplay_test_runner, ), params=[0], inv_eventually_validation_sequence_set=eventually_validation_sequence_set, diff --git a/src/software/conftest.py b/src/software/conftest.py index 0de2a5f4da..af7629159b 100644 --- a/src/software/conftest.py +++ b/src/software/conftest.py @@ -1,5 +1,4 @@ import pytest # noqa: F401 -from software.simulated_tests.simulated_test_fixture import simulated_test_runner # noqa: F401 from software.field_tests.field_test_fixture import field_test_runner # noqa: F401 from software.gameplay_tests.fixture import gameplay_test_runner diff --git a/src/software/field_tests/BUILD b/src/software/field_tests/BUILD index 6c42e9c284..482d08e15c 100644 --- a/src/software/field_tests/BUILD +++ b/src/software/field_tests/BUILD @@ -1,4 +1,4 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) @@ -15,7 +15,7 @@ py_library( "//software/logger:py_logger", "//software/networking/unix:threaded_unix_listener_py", "//software/networking/unix:threaded_unix_sender_py", - "//software/simulated_tests:tbots_test_runner", + "//software/gameplay_tests:tbots_test_runner", "//software/gameplay_tests/validation:validations", "//software/thunderscope", "//software/thunderscope:constants", @@ -38,7 +38,7 @@ py_test( ], deps = [ "//software:conftest", - "//software/simulated_tests:tbots_test_runner", + "//software/gameplay_tests:tbots_test_runner", "//software/gameplay_tests/validation:validations", requirement("pytest"), ], @@ -55,7 +55,7 @@ py_test( ], deps = [ "//software:conftest", - "//software/simulated_tests:tbots_test_runner", + "//software/gameplay_tests:tbots_test_runner", "//software/gameplay_tests/validation:validations", requirement("pytest"), ], diff --git a/src/software/field_tests/field_test_fixture.py b/src/software/field_tests/field_test_fixture.py index 7cdafc3393..490bdb10f5 100644 --- a/src/software/field_tests/field_test_fixture.py +++ b/src/software/field_tests/field_test_fixture.py @@ -18,7 +18,7 @@ from software.thunderscope.thunderscope_config import configure_field_test_view -from software.simulated_tests.tbots_test_runner import TbotsTestRunner +from software.gameplay_tests.tbots_test_runner import TbotsTestRunner from software.thunderscope.robot_communication import RobotCommunication from software.thunderscope.estop_helpers import get_estop_config from software.py_constants import * diff --git a/src/software/field_tests/movement_robot_field_test.py b/src/software/field_tests/movement_robot_field_test.py index 56c31df60b..a9decc3998 100644 --- a/src/software/field_tests/movement_robot_field_test.py +++ b/src/software/field_tests/movement_robot_field_test.py @@ -1,7 +1,7 @@ from proto.import_all_protos import * from software.field_tests.field_test_fixture import * -from software.simulated_tests.simulated_test_fixture import * +from software.gameplay_tests.util import * from software.logger.logger import create_logger import math @@ -14,7 +14,7 @@ # "robot_x_destination, robot_y_destination", # [(-2.0, -1), (-2.0, 1.0), (0.0, 1.0), (0.0, -1.0)], # ) -# def test_basic_movement(simulated_test_runner): +# def test_basic_movement(gameplay_test_runner): # # robot_starting_x = 0 # robot_starting_y = 0 @@ -40,7 +40,7 @@ # ball_location=tbots_cpp.Point(1, 1), # ball_velocity=tbots_cpp.Point(0, 0), # ) -# simulated_test_runner.set_world_state(initial_worldstate) +# gameplay_test_runner.set_world_state(initial_worldstate) # # # Setup Tactic # params = AssignedTacticPlayControlParams() @@ -59,9 +59,9 @@ # ), # ] # ] -# simulated_test_runner.set_tactics(params, True) +# gameplay_test_runner.set_tactics(params, True) # -# simulated_test_runner.run_test( +# gameplay_test_runner.run_test( # eventually_validation_sequence_set=eventually_validation_sequence_set, # test_timeout_s=5, # ) diff --git a/src/software/field_tests/passing_field_test.py b/src/software/field_tests/passing_field_test.py index 24bde002ba..97d0e4e459 100644 --- a/src/software/field_tests/passing_field_test.py +++ b/src/software/field_tests/passing_field_test.py @@ -4,7 +4,7 @@ from software.gameplay_tests.validation.friendly_receives_ball_slow import ( FriendlyAlwaysReceivesBallSlow, ) -from software.simulated_tests.simulated_test_fixture import ( +from software.gameplay_tests.util import ( pytest_main, ) diff --git a/src/software/field_tests/pivot_kick_field_test.py b/src/software/field_tests/pivot_kick_field_test.py index 6205bf12cf..bc820b3c03 100644 --- a/src/software/field_tests/pivot_kick_field_test.py +++ b/src/software/field_tests/pivot_kick_field_test.py @@ -2,9 +2,9 @@ from proto.import_all_protos import * from software.field_tests.field_test_fixture import * -from software.simulated_tests.simulated_test_fixture import * +from software.gameplay_tests.util import * from software.logger.logger import create_logger -from software.simulated_tests.simulated_test_fixture import ( +from software.gameplay_tests.util import ( pytest_main, ) diff --git a/src/software/gameplay_tests/requirements_lock.txt b/src/software/gameplay_tests/requirements_lock.txt index 8bf6d03071..e563375bdc 100644 --- a/src/software/gameplay_tests/requirements_lock.txt +++ b/src/software/gameplay_tests/requirements_lock.txt @@ -2,7 +2,7 @@ # This file is autogenerated by pip-compile with Python 3.12 # by the following command: # -# bazel run //software/simulated_tests:requirements.update +# bazel run //software/gameplay_tests:requirements.update # attrs==23.2.0 \ --hash=sha256:935dc3b529c262f6cf76e50877d35a4bd3c1de194fd41f47a2b7ae8f19971f30 \ @@ -27,7 +27,7 @@ py==1.11.0 \ pytest==6.2.5 \ --hash=sha256:131b36680866a76e6781d13f101efb86cf674ebb9762eb70d3082b6f29889e89 \ --hash=sha256:7310f8d27bc79ced999e760ca304d69f6ba6c6649c0b60fb0e04a4a77cacc134 - # via -r software/simulated_tests/requirements.in + # via -r software/gameplay_tests/requirements.in toml==0.10.2 \ --hash=sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b \ --hash=sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f diff --git a/src/software/gameplay_tests/simulated_test_runner.py b/src/software/gameplay_tests/simulated_test_runner.py index 3f6f8f5d81..7577210347 100644 --- a/src/software/gameplay_tests/simulated_test_runner.py +++ b/src/software/gameplay_tests/simulated_test_runner.py @@ -8,7 +8,7 @@ from proto.import_all_protos import * from software.logger.logger import create_logger -from software.simulated_tests.tbots_test_runner import TbotsTestRunner +from software.gameplay_tests.tbots_test_runner import TbotsTestRunner from software.gameplay_tests.validation import validation from software.thunderscope.thread_safe_buffer import ThreadSafeBuffer diff --git a/src/software/logger/logger.h b/src/software/logger/logger.h index df6691750e..44bfd16392 100644 --- a/src/software/logger/logger.h +++ b/src/software/logger/logger.h @@ -82,7 +82,7 @@ class LoggerSingleton // Standalone Simulator: // bazel-out/k8-fastbuild/bin/software/simulation/standalone_simulator_main.runfiles/__main__/ // Simulated - // tests:bazel-out/k8-fastbuild/bin/software/simulated_tests/TEST_NAME.runfiles/__main__/ + // tests:bazel-out/k8-fastbuild/bin/software/gameplay_tests/TEST_NAME.runfiles/__main__/ // where TEST_NAME is the name of the simulated test // Log locations can also be defined by setting the --logging_dir command-line diff --git a/src/software/sensor_fusion/filter/BUILD b/src/software/sensor_fusion/filter/BUILD index 90639ae83c..9f6faf6fce 100644 --- a/src/software/sensor_fusion/filter/BUILD +++ b/src/software/sensor_fusion/filter/BUILD @@ -1,4 +1,4 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//software/sensor_fusion:__subpackages__"]) diff --git a/src/software/sensor_fusion/filter/ball_occlusion_test.py b/src/software/sensor_fusion/filter/ball_occlusion_test.py index 38b07e569f..8a215a421f 100644 --- a/src/software/sensor_fusion/filter/ball_occlusion_test.py +++ b/src/software/sensor_fusion/filter/ball_occlusion_test.py @@ -7,7 +7,7 @@ from proto.message_translation.tbots_protobuf import create_world_state from proto.import_all_protos import Command from proto.ssl_gc_common_pb2 import Team -from software.simulated_tests.simulated_test_fixture import ( +from software.gameplay_tests.util import ( pytest_main, ) @@ -171,10 +171,10 @@ def test_ball_occlusion( ball_velocity, blue_robot_positions, yellow_robot_positions, - simulated_test_runner, + gameplay_test_runner, ): def setup(*args): - simulated_test_runner.set_world_state( + gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=blue_robot_positions, yellow_robot_locations=yellow_robot_positions, @@ -183,18 +183,18 @@ def setup(*args): ), ) - simulated_test_runner.send_gamecontroller_command( + gameplay_test_runner.send_gamecontroller_command( gc_command=Command.Type.HALT, team=Team.UNKNOWN ) - simulated_test_runner.set_plays( + gameplay_test_runner.set_plays( blue_play=PlayName.HaltPlay, yellow_play=PlayName.HaltPlay ) # This test validates that the ball tracking/filter handles occlusion correctly. # The validation simply waits for the simulation to run long enough (10s). # If the system crashes or has tracking issues, the test will fail. - simulated_test_runner.run_test( + gameplay_test_runner.run_test( setup=setup, test_timeout_s=10, ) diff --git a/src/software/simulated_tests/BUILD b/src/software/simulated_tests/BUILD deleted file mode 100644 index ad63716742..0000000000 --- a/src/software/simulated_tests/BUILD +++ /dev/null @@ -1,72 +0,0 @@ -load("@rules_python//python:pip.bzl", "compile_pip_requirements") -load("@simulated_tests_deps//:requirements.bzl", "requirement") - -package(default_visibility = ["//visibility:public"]) - -compile_pip_requirements( - name = "requirements", - src = "requirements.in", - requirements_txt = "requirements_lock.txt", -) - -py_library( - name = "tbots_test_runner", - srcs = [ - "tbots_test_runner.py", - ], - data = [ - "//software:py_constants.so", - ], - deps = [ - "//proto:import_all_protos", - "//software/logger:py_logger", - "//software/networking/unix:threaded_unix_listener_py", - "//software/networking/unix:threaded_unix_sender_py", - "//software/gameplay_tests/validation:validations", - "//software/thunderscope", - "//software/thunderscope:config", - "//software/thunderscope:constants", - "//software/thunderscope:time_provider", - "//software/thunderscope/binary_context_managers:full_system", - "//software/thunderscope/binary_context_managers:game_controller", - "//software/thunderscope/binary_context_managers:simulator", - ], -) - -py_library( - name = "simulated_test_fixture", - srcs = [ - "simulated_test_fixture.py", - ], - data = [ - "//software:py_constants.so", - ], - deps = [ - ":tbots_test_runner", - "//proto:import_all_protos", - "//software/logger:py_logger", - "//software/networking/unix:threaded_unix_listener_py", - "//software/networking/unix:threaded_unix_sender_py", - "//software/gameplay_tests/validation:validations", - "//software/thunderscope", - "//software/thunderscope/binary_context_managers:full_system", - "//software/thunderscope/binary_context_managers:game_controller", - "//software/thunderscope/binary_context_managers:simulator", - ], -) - -py_test( - name = "simulated_test_ball_model", - srcs = [ - "simulated_test_ball_model.py", - ], - # TODO (#2619) Remove tag to run in parallel - tags = [ - "exclusive", - ], - deps = [ - "//software:conftest", - "//software/gameplay_tests/validation:validations", - requirement("pytest"), - ], -) diff --git a/src/software/simulated_tests/requirements.in b/src/software/simulated_tests/requirements.in deleted file mode 100644 index 927094516e..0000000000 --- a/src/software/simulated_tests/requirements.in +++ /dev/null @@ -1 +0,0 @@ -pytest==6.2.5 diff --git a/src/software/simulated_tests/requirements_lock.txt b/src/software/simulated_tests/requirements_lock.txt deleted file mode 100644 index 8bf6d03071..0000000000 --- a/src/software/simulated_tests/requirements_lock.txt +++ /dev/null @@ -1,34 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.12 -# by the following command: -# -# bazel run //software/simulated_tests:requirements.update -# -attrs==23.2.0 \ - --hash=sha256:935dc3b529c262f6cf76e50877d35a4bd3c1de194fd41f47a2b7ae8f19971f30 \ - --hash=sha256:99b87a485a5820b23b879f04c2305b44b951b502fd64be915879d77a7e8fc6f1 - # via pytest -iniconfig==2.0.0 \ - --hash=sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3 \ - --hash=sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374 - # via pytest -packaging==24.1 \ - --hash=sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002 \ - --hash=sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124 - # via pytest -pluggy==1.5.0 \ - --hash=sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1 \ - --hash=sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669 - # via pytest -py==1.11.0 \ - --hash=sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719 \ - --hash=sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378 - # via pytest -pytest==6.2.5 \ - --hash=sha256:131b36680866a76e6781d13f101efb86cf674ebb9762eb70d3082b6f29889e89 \ - --hash=sha256:7310f8d27bc79ced999e760ca304d69f6ba6c6649c0b60fb0e04a4a77cacc134 - # via -r software/simulated_tests/requirements.in -toml==0.10.2 \ - --hash=sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b \ - --hash=sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f - # via pytest diff --git a/src/software/simulated_tests/simulated_test_ball_model.py b/src/software/simulated_tests/simulated_test_ball_model.py deleted file mode 100644 index 73c1d9c08a..0000000000 --- a/src/software/simulated_tests/simulated_test_ball_model.py +++ /dev/null @@ -1,193 +0,0 @@ -import pytest - -import software.python_bindings as tbots_cpp -from software.gameplay_tests.validation.robot_enters_region import * -from software.gameplay_tests.validation.ball_enters_region import * -from software.gameplay_tests.validation.ball_moves_in_direction import * -from software.gameplay_tests.validation.friendly_has_ball_possession import * -from software.gameplay_tests.validation.ball_speed_threshold import * -from software.gameplay_tests.validation.robot_speed_threshold import * -from software.gameplay_tests.validation.ball_stops_in_region import * -from software.gameplay_tests.validation.excessive_dribbling import * -from proto.message_translation.tbots_protobuf import create_world_state -from software.simulated_tests.simulated_test_fixture import ( - pytest_main, -) - -# the friction model currently used in the er-force simulator - -SLIDING_ACCELERATION = -3.432327 # equal to coeff_of_friction * g -ROLLING_ACCELERATION = -0.5 -TRANSITION_FACTOR = 5.0 / 7.0 -STOPPING_SPEED = 0.01 - - -@pytest.mark.parametrize( - "ball_initial_position,ball_initial_velocity", - [ - ( - tbots_cpp.Point(-3.5, 0), - tbots_cpp.Vector(2, 0), - ), - ( - tbots_cpp.Point(-3.5, 2), - tbots_cpp.Vector(3, -2), - ), - ( - tbots_cpp.Point(-3.5, -2), - tbots_cpp.Vector(3, 2), - ), - ( - tbots_cpp.Point(4.5, 3), - tbots_cpp.Vector(-3.5, -2), - ), - ], -) -def test_simulator_move_ball( - ball_initial_position, - ball_initial_velocity, - simulated_test_runner, -): - # Setup Ball - simulated_test_runner.simulator_proto_unix_io.send_proto( - WorldState, - create_world_state( - [], - blue_robot_locations=[], - ball_location=ball_initial_position, - ball_velocity=ball_initial_velocity, - ), - ) - - # Setup Tactic - params = AssignedTacticPlayControlParams() - - simulated_test_runner.blue_full_system_proto_unix_io.send_proto( - AssignedTacticPlayControlParams, params - ) - - # Setup no tactics on the enemy side - params = AssignedTacticPlayControlParams() - simulated_test_runner.yellow_full_system_proto_unix_io.send_proto( - AssignedTacticPlayControlParams, params - ) - - # expected ball position - initial_v = ball_initial_velocity.length() - - # velocity at which ball starts to roll - rolling_v = TRANSITION_FACTOR * initial_v - time_until_roll = abs((rolling_v - initial_v) / SLIDING_ACCELERATION) - time_until_stop = abs((rolling_v - STOPPING_SPEED) / ROLLING_ACCELERATION) - - d_slide = (initial_v + rolling_v) / 2 * time_until_roll - d_roll = (rolling_v / 2) * time_until_stop - total_distance = d_slide + d_roll - - ball_expected_position = ( - total_distance * ball_initial_velocity.normalize() + ball_initial_position - ) - - # Always Validation - always_validation_sequence_set = [ - [ - NeverExcessivelyDribbles(), - ] - ] - - # Eventually Validation - eventually_validation_sequence_set = [ - [ - BallEventuallyStopsInRegion( - [tbots_cpp.Circle(ball_expected_position, 0.1)] - ), - ] - ] - - simulated_test_runner.run_test( - test_timeout_s=8, - inv_eventually_validation_sequence_set=eventually_validation_sequence_set, - inv_always_validation_sequence_set=always_validation_sequence_set, - ) - - -def test_ball_robot_collision(simulated_test_runner): - ball_initial_position = tbots_cpp.Field.createSSLDivisionBField().centerPoint() - ball_initial_velocity = tbots_cpp.Vector(2.5, 0) - robot_position = tbots_cpp.Point(2.5, 0) - - # Setup Robot - simulated_test_runner.simulator_proto_unix_io.send_proto( - WorldState, - create_world_state( - [], - blue_robot_locations=[robot_position], - ball_location=ball_initial_position, - ball_velocity=ball_initial_velocity, - ), - ) - - # Setup Ball - simulated_test_runner.simulator_proto_unix_io.send_proto( - WorldState, - create_world_state( - [], - blue_robot_locations=[], - ball_location=ball_initial_position, - ball_velocity=ball_initial_velocity, - ), - ) - - # Setup Tactic - params = AssignedTacticPlayControlParams() - - simulated_test_runner.blue_full_system_proto_unix_io.send_proto( - AssignedTacticPlayControlParams, params - ) - - # Setup no tactics on the enemy side - params = AssignedTacticPlayControlParams() - simulated_test_runner.yellow_full_system_proto_unix_io.send_proto( - AssignedTacticPlayControlParams, params - ) - - # expected ball position - initial_v = ball_initial_velocity.length() - - # velocity at which ball starts to roll - rolling_v = TRANSITION_FACTOR * initial_v - time_until_roll = abs((rolling_v - initial_v) / SLIDING_ACCELERATION) - time_until_stop = abs((rolling_v - STOPPING_SPEED) / ROLLING_ACCELERATION) - - d_slide = (initial_v + rolling_v) / 2 * time_until_roll - d_roll = (rolling_v / 2) * time_until_stop - total_distance = d_slide + d_roll - - # expected position if there was no robot collision - ball_expected_position = ( - total_distance * ball_initial_velocity.normalize() + ball_initial_position - ) - - distance_from_robot = (ball_expected_position - robot_position).length() - - # Always Validation - always_validation_sequence_set = [] - - # Eventually Validation - eventually_validation_sequence_set = [ - [ - BallEventuallyStopsInRegion( - [tbots_cpp.Circle(robot_position, distance_from_robot)] - ), - ] - ] - - simulated_test_runner.run_test( - inv_eventually_validation_sequence_set=eventually_validation_sequence_set, - inv_always_validation_sequence_set=always_validation_sequence_set, - ) - - -if __name__ == "__main__": - # Run the test, -s disables all capturing at -vv increases verbosity - pytest_main(__file__) diff --git a/src/software/simulated_tests/simulated_test_fixture.py b/src/software/simulated_tests/simulated_test_fixture.py deleted file mode 100644 index d363af0011..0000000000 --- a/src/software/simulated_tests/simulated_test_fixture.py +++ /dev/null @@ -1,607 +0,0 @@ -import threading -import queue -import argparse -import time -import sys -import os - -import pytest -from proto.import_all_protos import * - -from software.gameplay_tests.validation import validation -from software.simulated_tests.tbots_test_runner import TbotsTestRunner -from software.thunderscope.thunderscope import Thunderscope -from software.thunderscope.proto_unix_io import ProtoUnixIO -from software.py_constants import MILLISECONDS_PER_SECOND -from software.thunderscope.binary_context_managers.full_system import FullSystem -from software.thunderscope.binary_context_managers.simulator import Simulator -from software.thunderscope.binary_context_managers.game_controller import Gamecontroller -from software.thunderscope.thunderscope_config import configure_simulated_test_view -from software.thunderscope.thread_safe_buffer import ThreadSafeBuffer - -from software.logger.logger import create_logger -from typing import override - -logger = create_logger(__name__) - -LAUNCH_DELAY_S = 0.1 -WORLD_BUFFER_TIMEOUT = 0.5 -PROCESS_BUFFER_DELAY_S = 0.01 -PAUSE_AFTER_FAIL_DELAY_S = 3 - - -class SimulatedTestRunner(TbotsTestRunner): - """Run a simulated test""" - - def __init__( - self, - test_name, - thunderscope, - simulator_proto_unix_io, - blue_full_system_proto_unix_io, - yellow_full_system_proto_unix_io, - gamecontroller, - ): - """Initialize the SimulatorTestRunner - - :param test_name: The name of the test to run - :param thunderscope: The Thunderscope to use, None if not used - :param simulator_proto_unix_io: The simulator proto unix io to use - :param blue_full_system_proto_unix_io: The blue full system proto unix io to use - :param yellow_full_system_proto_unix_io: The yellow full system proto unix io to use - :param gamecontroller: The gamecontroller context managed instance - """ - super(SimulatedTestRunner, self).__init__( - test_name, - thunderscope, - blue_full_system_proto_unix_io, - yellow_full_system_proto_unix_io, - gamecontroller, - ) - self.simulator_proto_unix_io = simulator_proto_unix_io - - @override - def set_world_state(self, worldstate: WorldState): - """Sets the simulation worldstate - - :param worldstate: proto containing the desired worldstate - """ - self.simulator_proto_unix_io.send_proto(WorldState, worldstate) - - def excepthook(self, args): - """This function is _critical_ for show_thunderscope to work. - If the test Thread will raises an exception we won't be able to close - the window from the main thread. - - :param args: The args passed in from the hook - """ - self.__stopper(delay=PAUSE_AFTER_FAIL_DELAY_S) - self.last_exception = args.exc_value - raise self.last_exception - - def __stopper(self, delay=PROCESS_BUFFER_DELAY_S): - """Stop running the test - - :param delay: How long to wait before closing everything, defaults - to PROCESS_BUFFER_DELAY_S to minimize buffer warnings - """ - time.sleep(delay) - - if self.thunderscope: - self.thunderscope.close() - - def sync_setup(self, setup, param): - """Run setup until simulator has received game state - - :param setup: Function that sets up the world state - :param param: Parameter passed into setup - """ - world_state_received_buffer = ThreadSafeBuffer(1, WorldStateReceivedTrigger) - self.simulator_proto_unix_io.register_observer( - WorldStateReceivedTrigger, world_state_received_buffer - ) - - while True: - setup(param) - - try: - world_state_received_buffer.get( - block=True, timeout=WORLD_BUFFER_TIMEOUT - ) - except queue.Empty: - # Did not receive a response within timeout period - continue - else: - # Received a response from the simulator - break - - def runner( - self, - always_validation_sequence_set, - eventually_validation_sequence_set, - test_timeout_s, - tick_duration_s, - ci_cmd_with_delay, - run_till_end, - ): - """Run a test - - :param always_validation_sequence_set: Validation functions that should - hold on every tick - :param eventually_validation_sequence_set: Validation that should - eventually be true, before the test ends - :param test_timeout_s: The timeout for the test, if any eventually_validations - remain after the timeout, the test fails. - :param tick_duration_s: The simulation step duration - :param ci_cmd_with_delay: A list consisting of tuples with a duration and CI command, e.g. - [ - (time, command, team), - (time, command, team), - ... - ] - :param run_till_end: If true, test runs till the end even if eventually validation passes - If false, test stops once eventually validation passes and fails if time out - """ - time_elapsed_s = 0 - - eventually_validation_failure_msg = "Test Timed Out" - - while time_elapsed_s < test_timeout_s: - # get time before we execute the loop - processing_start_time = time.time() - - # Check for new CI commands at this time step - for delay, cmd, team in ci_cmd_with_delay: - # If delay matches time - if delay <= time_elapsed_s: - # send command - self.gamecontroller.send_gc_command(gc_command=cmd, team=team) - # remove command from the list - ci_cmd_with_delay.remove((delay, cmd, team)) - - tick = SimulatorTick(milliseconds=tick_duration_s * MILLISECONDS_PER_SECOND) - self.simulator_proto_unix_io.send_proto(SimulatorTick, tick) - time_elapsed_s += tick_duration_s - - while True: - try: - world = self.world_buffer.get( - block=True, timeout=WORLD_BUFFER_TIMEOUT, return_cached=False - ) - - # We block until the timeout for the new primitives from AI. if not found still, - # the SSL Wrapper packet is resent in a loop until we actually get a primitive set from AI - # Otherwise, if the AI misses the first SSL Wrapper packet and doesn't start - # the simulated test will continue to tick forward, causes syncing issues with the AI - self.primitive_set_buffer.get( - block=True, timeout=WORLD_BUFFER_TIMEOUT, return_cached=False - ) - - break - except queue.Empty: - # If we timeout, that means full_system missed the last - # wrapper and robot status, lets resend it. - logger.warning("Fullsystem missed last wrapper, resending ...") - - ssl_wrapper = self.ssl_wrapper_buffer.get(block=False) - robot_status = self.robot_status_buffer.get(block=False) - - self.blue_full_system_proto_unix_io.send_proto( - SSL_WrapperPacket, ssl_wrapper - ) - self.blue_full_system_proto_unix_io.send_proto( - RobotStatus, robot_status - ) - - # get the time difference after we get the primitive (after any blocking that happened) - processing_time = time.time() - processing_start_time - - # if the time we have blocked is less than a tick, sleep for the remaining time (for Thunderscope only) - if self.thunderscope and tick_duration_s > processing_time: - time.sleep(tick_duration_s - processing_time) - - # Validate - ( - eventually_validation_proto_set, - always_validation_proto_set, - ) = validation.run_validation_sequence_sets( - world, - eventually_validation_sequence_set, - always_validation_sequence_set, - ) - - # Set the test name - eventually_validation_proto_set.test_name = self.test_name - always_validation_proto_set.test_name = self.test_name - - # Send out the validation proto to the full system - # for visualization and logging for replays. - if self.is_yellow_friendly: - self.yellow_full_system_proto_unix_io.send_proto( - ValidationProtoSet, eventually_validation_proto_set - ) - self.yellow_full_system_proto_unix_io.send_proto( - ValidationProtoSet, always_validation_proto_set - ) - else: - self.blue_full_system_proto_unix_io.send_proto( - ValidationProtoSet, eventually_validation_proto_set - ) - self.blue_full_system_proto_unix_io.send_proto( - ValidationProtoSet, always_validation_proto_set - ) - - # Check that all always validations are always valid - validation.check_validation(always_validation_proto_set) - - if not run_till_end: - try: - # Check that all eventually validations are eventually valid - validation.check_validation(eventually_validation_proto_set) - self.__stopper() - return - except AssertionError as e: - eventually_validation_failure_msg = str(e) - - if not run_till_end: - raise AssertionError(eventually_validation_failure_msg) - - # Check that all eventually validations are eventually valid - validation.check_validation(eventually_validation_proto_set) - - self.__stopper() - - @override - def run_test( - self, - always_validation_sequence_set, - eventually_validation_sequence_set, - test_timeout_s=3, - tick_duration_s=0.0166, # Default to 60hz - index=0, - ci_cmd_with_delay=[], - run_till_end=True, - **kwargs, - ): - """Helper function to run a test, with thunderscope if enabled - - :param always_validation_sequence_set: validation that should always be true - :param eventually_validation_sequence_set: validation that should eventually be true - :param test_timeout_s: how long the test should run before timing out - :param tick_duration_s: length of a tick - :param index: index of the current test. default is 0 (invariant test) - values can be passed in during aggregate testing for different timeout durations - :param ci_cmd_with_delay: A list consisting of tuples with a duration and CI command, e.g. - [ - (time, command, team), - (time, command, team), - ... - ] - :param run_till_end: If true, test runs till the end even if eventually validation passes - If false, test stops once eventually validation passes and fails if time out - """ - test_timeout_duration = ( - test_timeout_s[index] if type(test_timeout_s) == list else test_timeout_s - ) - - # If thunderscope is enabled, run the test in a thread and show - # thunderscope on this thread. The excepthook is setup to catch - # any test failures and propagate them to the main thread - if self.thunderscope: - run_sim_thread = threading.Thread( - target=self.runner, - daemon=True, - args=[ - always_validation_sequence_set, - eventually_validation_sequence_set, - test_timeout_duration, - tick_duration_s, - ci_cmd_with_delay, - run_till_end, - ], - ) - run_sim_thread.start() - self.thunderscope.show() - run_sim_thread.join() - - if self.last_exception: - pytest.fail(str(self.last_exception)) - - # If thunderscope is disabled, just run the test - else: - self.runner( - always_validation_sequence_set, - eventually_validation_sequence_set, - test_timeout_duration, - tick_duration_s, - ci_cmd_with_delay=ci_cmd_with_delay, - run_till_end=run_till_end, - ) - - -class InvariantTestRunner(SimulatedTestRunner): - """Runs a simulated test only once with a given parameter - - Test passes or fails based on the outcome of this test - """ - - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - - @override - def run_test( - self, - setup=(lambda x: None), - params=[0], - inv_always_validation_sequence_set=[[]], - inv_eventually_validation_sequence_set=[[]], - **kwargs, - ): - """Run an invariant test - - :param setup: Function that sets up the World state and the gamecontroller before running the test - :param params: List of parameters for each iteration of the test - (this method only uses the first element) - :param inv_always_validation_sequence_set: Validation functions for invariant testing - that should hold on every tick - :param inv_eventually_validation_sequence_set: Validation functions for invariant testing - that should eventually be true, before the test ends - """ - threading.excepthook = self.excepthook - - super().sync_setup(setup, params[0]) - - super().run_test( - inv_always_validation_sequence_set, - inv_eventually_validation_sequence_set, - **kwargs, - ) - - -class AggregateTestRunner(SimulatedTestRunner): - """Runs a simulated test multiple times with different given parameters - - Result of the test is determined by comparing the number of - passing iterations to a predetermined acceptable threshold - """ - - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - - @override - def run_test( - self, - setup=(lambda arg: None), - params=[], - ag_always_validation_sequence_set=[[]], - ag_eventually_validation_sequence_set=[[]], - **kwargs, - ): - """Run an aggregate test - - :param setup: Function that sets up the World state and the gamecontroller before running the test - :param params: List of parameters for each iteration of the test - :param ag_always_validation_sequence_set: Validation functions for aggregate testing - that should hold on every tick - :param ag_eventually_validation_sequence_set: Validation functions for aggregate testing - that should eventually be true, before the test end - """ - threading.excepthook = self.excepthook - - failed_tests = 0 - - # Runs the test once for each given parameter - # Catches Assertion Error thrown by failing test and increments counter - # Calculates overall results and prints them - for x in range(len(params)): - super().sync_setup(setup, params[x]) - - try: - super().run_test( - ag_always_validation_sequence_set, - ag_eventually_validation_sequence_set, - **kwargs, - ) - except AssertionError: - failed_tests += 1 - - # TODO (#2856) Fix validation and results output - - logger.info(f"{failed_tests} test failed") - - assert failed_tests == 0 - - -def load_command_line_arguments(allow_unrecognized: bool = False): - """Load in command-line arguments using argparse - - NOTE: Pytest has its own built in argument parser (conftest.py, pytest_addoption) - but it doesn't seem to play nicely with bazel. We just use argparse instead. - - :param allow_unrecognized: if true, does not raise an error for unrecognized arguments - """ - parser = argparse.ArgumentParser(description="Run simulated pytests") - parser.add_argument( - "--enable_thunderscope", action="store_true", help="enable thunderscope" - ) - parser.add_argument( - "--aggregate", action="store_true", default=False, help="Run aggregate test" - ) - parser.add_argument( - "--simulator_runtime_dir", - type=str, - help="simulator runtime directory", - default="/tmp/tbots", - ) - parser.add_argument( - "--blue_full_system_runtime_dir", - type=str, - help="blue full_system runtime directory", - default="/tmp/tbots/blue", - ) - parser.add_argument( - "--yellow_full_system_runtime_dir", - type=str, - help="yellow full_system runtime directory", - default="/tmp/tbots/yellow", - ) - parser.add_argument( - "--layout", - action="store", - help="Which layout to run, if not specified the last layout will run", - ) - parser.add_argument( - "--debug_blue_full_system", - action="store_true", - default=False, - help="Debug blue full_system", - ) - parser.add_argument( - "--debug_yellow_full_system", - action="store_true", - default=False, - help="Debug yellow full_system", - ) - parser.add_argument( - "--debug_simulator", - action="store_true", - default=False, - help="Debug the simulator", - ) - parser.add_argument( - "--visualization_buffer_size", - action="store", - type=int, - default=5, - help="How many packets to buffer while rendering", - ) - parser.add_argument( - "--show_gamecontroller_logs", - action="store_true", - default=False, - help="Show gamecontroller logs", - ) - parser.add_argument( - "--test_filter", - action="store", - default="", - help="The test filter, if not specified all tests will run. " - + "See https://docs.pytest.org/en/latest/how-to/usage.html#specifying-tests-selecting-tests", - ) - parser.add_argument( - "--enable_realism", - action="store_true", - default=False, - help="Use realism in the simulator", - ) - return parser.parse_known_args()[0] if allow_unrecognized else parser.parse_args() - - -def pytest_main(file): - """Runs the pytest file - - :param file: The test file to run - """ - args = load_command_line_arguments(allow_unrecognized=True) - - # Run the test, -s disables all capturing at -vv increases verbosity - # -W ignore::DeprecationWarning ignores deprecation warnings that spam the output - sys.exit( - pytest.main( - ["-svv", "-W ignore::DeprecationWarning", "-k", args.test_filter, file] - ) - ) - - -@pytest.fixture -def simulated_test_runner(): - args = load_command_line_arguments() - tscope = None - - aggregate = args.aggregate - - simulator_proto_unix_io = ProtoUnixIO() - yellow_full_system_proto_unix_io = ProtoUnixIO() - blue_full_system_proto_unix_io = ProtoUnixIO() - - # Grab the current test name to store the proto log for the test case - current_test = os.environ.get("PYTEST_CURRENT_TEST").split(":")[-1].split(" ")[0] - current_test = current_test.replace("]", "") - current_test = current_test.replace("[", "-") - - test_name = current_test.split("-")[0] - - # Launch all binaries - with Simulator( - f"{args.simulator_runtime_dir}/test/{test_name}", - args.debug_simulator, - args.enable_realism, - ) as simulator, FullSystem( - "software/unix_full_system", - f"{args.blue_full_system_runtime_dir}/test/{test_name}", - args.debug_blue_full_system, - False, - should_restart_on_crash=False, - running_in_realtime=args.enable_thunderscope, - ) as blue_fs, FullSystem( - "software/unix_full_system", - f"{args.yellow_full_system_runtime_dir}/test/{test_name}", - args.debug_yellow_full_system, - True, - should_restart_on_crash=False, - running_in_realtime=args.enable_thunderscope, - ) as yellow_fs: - with Gamecontroller( - suppress_logs=(not args.show_gamecontroller_logs) - ) as gamecontroller: - blue_fs.setup_proto_unix_io(blue_full_system_proto_unix_io) - yellow_fs.setup_proto_unix_io(yellow_full_system_proto_unix_io) - simulator.setup_proto_unix_io( - simulator_proto_unix_io, - blue_full_system_proto_unix_io, - yellow_full_system_proto_unix_io, - ProtoUnixIO(), - ) - gamecontroller.setup_proto_unix_io( - blue_full_system_proto_unix_io=blue_full_system_proto_unix_io, - yellow_full_system_proto_unix_io=yellow_full_system_proto_unix_io, - simulator_proto_unix_io=simulator_proto_unix_io, - ) - - # If we want to run thunderscope, inject the proto unix ios - # and start the test - if args.enable_thunderscope: - tscope = Thunderscope( - configure_simulated_test_view( - blue_full_system_proto_unix_io=blue_full_system_proto_unix_io, - yellow_full_system_proto_unix_io=yellow_full_system_proto_unix_io, - simulator_proto_unix_io=simulator_proto_unix_io, - ), - layout_path=args.layout, - ) - - time.sleep(LAUNCH_DELAY_S) - - runner = None - - # Initialise the right runner based on which testing mode is selected - if aggregate: - runner = AggregateTestRunner( - current_test, - tscope, - simulator_proto_unix_io, - blue_full_system_proto_unix_io, - yellow_full_system_proto_unix_io, - gamecontroller, - ) - else: - runner = InvariantTestRunner( - current_test, - tscope, - simulator_proto_unix_io, - blue_full_system_proto_unix_io, - yellow_full_system_proto_unix_io, - gamecontroller, - ) - - yield runner diff --git a/src/software/simulated_tests/tbots_test_runner.py b/src/software/simulated_tests/tbots_test_runner.py deleted file mode 100644 index 03e7d4ae85..0000000000 --- a/src/software/simulated_tests/tbots_test_runner.py +++ /dev/null @@ -1,161 +0,0 @@ -from proto.import_all_protos import * -from software.logger.logger import create_logger -from software.thunderscope.thread_safe_buffer import ThreadSafeBuffer -from abc import abstractmethod -from typing import Any - -logger = create_logger(__name__) - - -class TbotsTestRunner: - """An abstract class that represents a test runner""" - - def __init__( - self, - test_name, - thunderscope, - blue_full_system_proto_unix_io, - yellow_full_system_proto_unix_io, - gamecontroller, - is_yellow_friendly=False, - ): - """Initialize the TestRunner. - - :param test_name: The name of the test to run - :param thunderscope: The Thunderscope to use, None if not used - :param blue_full_system_proto_unix_io: The blue full system proto unix io to use - :param yellow_full_system_proto_unix_io: The yellow full system proto unix io to use - :param gamecontroller: The gamecontroller context managed instance - :param: is_yellow_friendly: if yellow is the friendly team - """ - self.test_name = test_name - self.thunderscope = thunderscope - self.blue_full_system_proto_unix_io = blue_full_system_proto_unix_io - self.yellow_full_system_proto_unix_io = yellow_full_system_proto_unix_io - self.gamecontroller = gamecontroller - self.is_yellow_friendly = is_yellow_friendly - self.world_buffer = ThreadSafeBuffer(buffer_size=20, protobuf_type=World) - self.primitive_set_buffer = ThreadSafeBuffer( - buffer_size=1, protobuf_type=PrimitiveSet - ) - self.last_exception = None - - self.ssl_wrapper_buffer = ThreadSafeBuffer( - buffer_size=1, protobuf_type=SSL_WrapperPacket - ) - self.robot_status_buffer = ThreadSafeBuffer( - buffer_size=1, protobuf_type=RobotStatus - ) - - self.blue_full_system_proto_unix_io.register_observer( - SSL_WrapperPacket, self.ssl_wrapper_buffer - ) - self.blue_full_system_proto_unix_io.register_observer( - RobotStatus, self.robot_status_buffer - ) - if self.is_yellow_friendly: - self.yellow_full_system_proto_unix_io.register_observer( - World, self.world_buffer - ) - self.yellow_full_system_proto_unix_io.register_observer( - PrimitiveSet, self.primitive_set_buffer - ) - # Only validate on the blue worlds - else: - self.blue_full_system_proto_unix_io.register_observer( - World, self.world_buffer - ) - self.blue_full_system_proto_unix_io.register_observer( - PrimitiveSet, self.primitive_set_buffer - ) - - def send_gamecontroller_command( - self, - gc_command: proto.ssl_gc_state_pb2.Command, - team: proto.ssl_gc_common_pb2.Team, - final_ball_placement_point=None, - ): - """Sends a gamecontroller command that is to be broadcasted to the given team - - :param gc_command: the gamecontroller command - :param is_friendly: whether the command should be sent to the friendly team - :param final_ball_placement_point: where to place the ball in ball placement - """ - self.gamecontroller.send_gc_command( - gc_command=gc_command, - team=team, - final_ball_placement_point=final_ball_placement_point, - ) - - def set_tactics( - self, - blue_tactics: dict[int, Any] | None = {}, - yellow_tactics: dict[int, Any] | None = {}, - ): - """Overrides AI tactics for all robots on each team. - By default, assigns no tactic for all robots whose id is not specified. - Pass in a None value for a team's tactics to not send tactics override. - - :param blue_tactics: None or dict of robot_id -> tactic for blue team - :param yellow_tactics: None or dict of robot_id -> tactic for yellow team - """ - if blue_tactics is not None: - blue_params = self._create_assigned_tactic_params(blue_tactics) - self.blue_full_system_proto_unix_io.send_proto( - AssignedTacticPlayControlParams, blue_params - ) - - if yellow_tactics is not None: - yellow_params = self._create_assigned_tactic_params(yellow_tactics) - self.yellow_full_system_proto_unix_io.send_proto( - AssignedTacticPlayControlParams, yellow_params - ) - - def set_plays(self, blue_play: PlayName, yellow_play: PlayName): - """Overrides current AI play for both teams - - :param blue_play: the play name for the blue team to use - :param yellow_play: the play name for the yellow team to use - """ - self.blue_full_system_proto_unix_io.send_proto(Play, Play(name=blue_play)) - self.yellow_full_system_proto_unix_io.send_proto(Play, Play(name=yellow_play)) - - def _create_assigned_tactic_params(self, tactics: dict[int, Any]): - """Converts dict of tactics to AssignedTacticPlayControlParams message - - :param tactics: dict of robot_id -> tactic - """ - params = AssignedTacticPlayControlParams() - - # Checks which oneof field in Tactic to assign the specified tactic to - for robot_id, specific_tactic in tactics.items(): - tactic = params.assigned_tactics[robot_id] - for field in tactic.DESCRIPTOR.oneofs_by_name["tactic"].fields: - if field.message_type == specific_tactic.DESCRIPTOR: - getattr(tactic, field.name).CopyFrom(specific_tactic) - break - - return params - - @abstractmethod - def set_world_state(self, worldstate: WorldState): - """Sets the worldstate for the given team - - :param worldstate: the worldstate proto to use - """ - raise NotImplementedError("abstract class method called set_world_state") - - @abstractmethod - def run_test( - self, - always_validation_sequence_set=[[]], - eventually_validation_sequence_set=[[]], - test_timeout_s=3, - ): - """Begins validating a test based on incoming world protos - - :param always_validation_sequence_set: validation set that must always be true - :param eventually_validation_sequence_set: validation set that must eventually be true - :param test_timeout_s: how long the test will run - """ - raise NotImplementedError("abstract method run_test called from base class") diff --git a/src/software/thunderscope/replay/test/BUILD b/src/software/thunderscope/replay/test/BUILD index 9b994ec17b..f65f871c21 100644 --- a/src/software/thunderscope/replay/test/BUILD +++ b/src/software/thunderscope/replay/test/BUILD @@ -1,4 +1,4 @@ -load("@simulated_tests_deps//:requirements.bzl", "requirement") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) diff --git a/src/software/thunderscope/replay/test/replay_corruption_test.py b/src/software/thunderscope/replay/test/replay_corruption_test.py index da16eb8b2d..7d43c1ca3e 100644 --- a/src/software/thunderscope/replay/test/replay_corruption_test.py +++ b/src/software/thunderscope/replay/test/replay_corruption_test.py @@ -26,7 +26,7 @@ from software.thunderscope.constants import ProtoPlayerFlags from software.thunderscope.replay.proto_player import ProtoPlayer from software.thunderscope.proto_unix_io import ProtoUnixIO -from software.simulated_tests.simulated_test_fixture import pytest_main +from software.gameplay_tests.util import pytest_main random.seed(0) diff --git a/src/software/thunderscope/replay/test/replay_indexing_test.py b/src/software/thunderscope/replay/test/replay_indexing_test.py index 4d58d3a05d..4d721e5d26 100644 --- a/src/software/thunderscope/replay/test/replay_indexing_test.py +++ b/src/software/thunderscope/replay/test/replay_indexing_test.py @@ -13,7 +13,7 @@ from software.thunderscope.replay.proto_player import ProtoPlayer from software.thunderscope.proto_unix_io import ProtoUnixIO -from software.simulated_tests.simulated_test_fixture import pytest_main +from software.gameplay_tests.util import pytest_main from software.thunderscope.replay.test.replay_corruption_test import ( create_valid_log_entry, create_random_proto, From cd4e5dda62266c0f6dba6c7d01fdd4da09434a16 Mon Sep 17 00:00:00 2001 From: Eric Xiao Date: Tue, 26 May 2026 17:22:02 -0700 Subject: [PATCH 04/18] Restore move_tactic_test --- .../ai/hl/stp/tactic/move/move_tactic_test.py | 438 +++++++++--------- 1 file changed, 219 insertions(+), 219 deletions(-) diff --git a/src/software/ai/hl/stp/tactic/move/move_tactic_test.py b/src/software/ai/hl/stp/tactic/move/move_tactic_test.py index bfbb56ce8d..de2aacca44 100644 --- a/src/software/ai/hl/stp/tactic/move/move_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/move/move_tactic_test.py @@ -81,225 +81,225 @@ def setup(*args): ) -# def test_autochip_move(gameplay_test_runner): -# initial_position = tbots_cpp.Point(-3, 1.5) -# destination = tbots_cpp.Point(0, 1.5) -# field = tbots_cpp.Field.createSSLDivisionBField() -# -# def setup(*args): -# gameplay_test_runner.set_world_state( -# create_world_state( -# blue_robot_locations=[ -# tbots_cpp.Point(-3, 2.5), -# initial_position, -# ], -# yellow_robot_locations=[ -# tbots_cpp.Point(1, 0), -# tbots_cpp.Point(1, 2.5), -# tbots_cpp.Point(1, -2.5), -# field.enemyGoalCenter(), -# field.enemyDefenseArea().negXNegYCorner(), -# field.enemyDefenseArea().negXPosYCorner(), -# ], -# ball_location=destination, -# ball_velocity=tbots_cpp.Vector(0, 0), -# ), -# ) -# -# gameplay_test_runner.set_tactics( -# blue_tactics={ -# 1: MoveTactic( -# destination=tbots_cpp.createPointProto(destination), -# final_orientation=tbots_cpp.createAngleProto( -# tbots_cpp.Angle.zero() -# ), -# dribbler_mode=DribblerMode.OFF, -# ball_collision_type=BallCollisionType.ALLOW, -# auto_chip_or_kick=AutoChipOrKick(autochip_distance_meters=2.0), -# max_allowed_speed_mode=MaxAllowedSpeedMode.COLLISIONS_ALLOWED, -# obstacle_avoidance_mode=ObstacleAvoidanceMode.SAFE, -# ) -# } -# ) -# -# eventually_validation_sequence_set = [ -# [ -# # Robot moves to position and chips ball -# RobotEventuallyAtPosition(1, destination), -# BallEventuallyKickedInDirection(tbots_cpp.Angle.zero()), -# BallIsEventuallyOffGround(), -# # Robot stays at destination for one second -# DurationValidation( -# duration_s=1, validation=RobotEventuallyAtPosition(1, destination) -# ), -# ] -# ] -# -# gameplay_test_runner.run_test( -# setup=setup, -# inv_eventually_validation_sequence_set=eventually_validation_sequence_set, -# ag_eventually_validation_sequence_set=eventually_validation_sequence_set, -# test_timeout_s=10, -# ) -# -# -# def test_autokick_move(gameplay_test_runner): -# initial_position = tbots_cpp.Point(-1, -0.5) -# destination = tbots_cpp.Point(-1, -1) -# field = tbots_cpp.Field.createSSLDivisionBField() -# -# def setup(*args): -# gameplay_test_runner.set_world_state( -# create_world_state( -# blue_robot_locations=[initial_position], -# blue_robot_orientations=[tbots_cpp.Angle.threeQuarter()], -# yellow_robot_locations=[ -# tbots_cpp.Point(1, 0), -# tbots_cpp.Point(1, 2.5), -# tbots_cpp.Point(1, -2.5), -# field.enemyGoalCenter(), -# field.enemyDefenseArea().negXNegYCorner(), -# field.enemyDefenseArea().negXPosYCorner(), -# ], -# ball_location=destination, -# ball_velocity=tbots_cpp.Vector(0, 0), -# ), -# ) -# -# gameplay_test_runner.set_tactics( -# blue_tactics={ -# 0: MoveTactic( -# destination=tbots_cpp.createPointProto(destination), -# final_orientation=tbots_cpp.createAngleProto( -# tbots_cpp.Angle.threeQuarter() -# ), -# dribbler_mode=DribblerMode.OFF, -# ball_collision_type=BallCollisionType.ALLOW, -# auto_chip_or_kick=AutoChipOrKick(autokick_speed_m_per_s=3.0), -# max_allowed_speed_mode=MaxAllowedSpeedMode.COLLISIONS_ALLOWED, -# obstacle_avoidance_mode=ObstacleAvoidanceMode.SAFE, -# ) -# } -# ) -# -# eventually_validation_sequence_set = [ -# [ -# # Robot moves to destination and kicks -# RobotEventuallyAtPosition(0, destination), -# BallEventuallyKickedInDirection(tbots_cpp.Angle.threeQuarter()), -# # Robot stays at destination for one second -# DurationValidation( -# duration_s=1, validation=RobotEventuallyAtPosition(0, destination) -# ), -# ] -# ] -# -# gameplay_test_runner.run_test( -# setup=setup, -# inv_eventually_validation_sequence_set=eventually_validation_sequence_set, -# ag_eventually_validation_sequence_set=eventually_validation_sequence_set, -# test_timeout_s=5, -# ) -# -# -# @pytest.mark.parametrize( -# "orientation, initial_position, destination, angular_velocity", -# [ -# # Robot facing right, should rotate counter clockwise to face up -# ( -# tbots_cpp.Angle.quarter(), -# tbots_cpp.Point(2, 0), -# tbots_cpp.Point(-2, 0), -# tbots_cpp.Angle.fromDegrees(360), -# ), -# # Robot facing right, should rotate clockwise to face down -# ( -# tbots_cpp.Angle.threeQuarter(), -# tbots_cpp.Point(2, 0), -# tbots_cpp.Point(-2, 0), -# tbots_cpp.Angle.fromDegrees(-360), -# ), -# # Robot facing right, should rotate counter clockwise to face up -# ( -# tbots_cpp.Angle.quarter(), -# tbots_cpp.Point(0, 0), -# tbots_cpp.Point(0, 0), -# tbots_cpp.Angle.fromDegrees(360), -# ), -# # Robot facing right, should rotate clockwise to face down -# ( -# tbots_cpp.Angle.threeQuarter(), -# tbots_cpp.Point(0, 0), -# tbots_cpp.Point(0, 0), -# tbots_cpp.Angle.fromDegrees(-360), -# ), -# # Robot facing right, should rotate counter clockwise to face left, slightly up -# ( -# tbots_cpp.Angle.fromDegrees(175), -# tbots_cpp.Point(3, -1), -# tbots_cpp.Point(0, 1), -# tbots_cpp.Angle.fromDegrees(360), -# ), -# # Robot facing right, should rotate clockwise to face down -# ( -# tbots_cpp.Angle.fromDegrees(185), -# tbots_cpp.Point(3, -1), -# tbots_cpp.Point(0, 1), -# tbots_cpp.Angle.fromDegrees(-360), -# ), -# ], -# ) -# def test_spinning_move( -# orientation, initial_position, destination, angular_velocity, gameplay_test_runner -# ): -# def setup(*args): -# gameplay_test_runner.set_world_state( -# create_world_state( -# blue_robot_locations=[initial_position], -# yellow_robot_locations=[tbots_cpp.Point(4, 0)], -# ball_location=tbots_cpp.Point(1, 1), -# ball_velocity=tbots_cpp.Vector(0, 0), -# ), -# ) -# -# gameplay_test_runner.set_tactics( -# blue_tactics={ -# 0: MoveTactic( -# destination=tbots_cpp.createPointProto(destination), -# final_orientation=tbots_cpp.createAngleProto(orientation), -# dribbler_mode=DribblerMode.OFF, -# ball_collision_type=BallCollisionType.ALLOW, -# auto_chip_or_kick=AutoChipOrKick(), -# max_allowed_speed_mode=MaxAllowedSpeedMode.PHYSICAL_LIMIT, -# obstacle_avoidance_mode=ObstacleAvoidanceMode.SAFE, -# ) -# } -# ) -# -# eventually_validation_sequence_set = [ -# [ -# # High threshold to check direction of angular velocity -# RobotEventuallyAtAngularVelocity(0, angular_velocity, 4), -# # Robot stays at destination for one second -# DurationValidation( -# duration_s=1, validation=RobotEventuallyAtPosition(0, destination) -# ), -# ], -# [ -# # Robot stays at orientation for one second once it has reached the destination -# RobotEventuallyAtPosition(0, destination), -# DurationValidation( -# duration_s=1, validation=RobotEventuallyAtOrientation(0, orientation) -# ), -# ], -# ] -# -# gameplay_test_runner.run_test( -# setup=setup, -# inv_eventually_validation_sequence_set=eventually_validation_sequence_set, -# ag_eventually_validation_sequence_set=eventually_validation_sequence_set, -# test_timeout_s=5, -# ) +def test_autochip_move(gameplay_test_runner): + initial_position = tbots_cpp.Point(-3, 1.5) + destination = tbots_cpp.Point(0, 1.5) + field = tbots_cpp.Field.createSSLDivisionBField() + + def setup(*args): + gameplay_test_runner.set_world_state( + create_world_state( + blue_robot_locations=[ + tbots_cpp.Point(-3, 2.5), + initial_position, + ], + yellow_robot_locations=[ + tbots_cpp.Point(1, 0), + tbots_cpp.Point(1, 2.5), + tbots_cpp.Point(1, -2.5), + field.enemyGoalCenter(), + field.enemyDefenseArea().negXNegYCorner(), + field.enemyDefenseArea().negXPosYCorner(), + ], + ball_location=destination, + ball_velocity=tbots_cpp.Vector(0, 0), + ), + ) + + gameplay_test_runner.set_tactics( + blue_tactics={ + 1: MoveTactic( + destination=tbots_cpp.createPointProto(destination), + final_orientation=tbots_cpp.createAngleProto( + tbots_cpp.Angle.zero() + ), + dribbler_mode=DribblerMode.OFF, + ball_collision_type=BallCollisionType.ALLOW, + auto_chip_or_kick=AutoChipOrKick(autochip_distance_meters=2.0), + max_allowed_speed_mode=MaxAllowedSpeedMode.COLLISIONS_ALLOWED, + obstacle_avoidance_mode=ObstacleAvoidanceMode.SAFE, + ) + } + ) + + eventually_validation_sequence_set = [ + [ + # Robot moves to position and chips ball + RobotEventuallyAtPosition(1, destination), + BallEventuallyKickedInDirection(tbots_cpp.Angle.zero()), + BallIsEventuallyOffGround(), + # Robot stays at destination for one second + DurationValidation( + duration_s=1, validation=RobotEventuallyAtPosition(1, destination) + ), + ] + ] + + gameplay_test_runner.run_test( + setup=setup, + inv_eventually_validation_sequence_set=eventually_validation_sequence_set, + ag_eventually_validation_sequence_set=eventually_validation_sequence_set, + test_timeout_s=10, + ) + + +def test_autokick_move(gameplay_test_runner): + initial_position = tbots_cpp.Point(-1, -0.5) + destination = tbots_cpp.Point(-1, -1) + field = tbots_cpp.Field.createSSLDivisionBField() + + def setup(*args): + gameplay_test_runner.set_world_state( + create_world_state( + blue_robot_locations=[initial_position], + blue_robot_orientations=[tbots_cpp.Angle.threeQuarter()], + yellow_robot_locations=[ + tbots_cpp.Point(1, 0), + tbots_cpp.Point(1, 2.5), + tbots_cpp.Point(1, -2.5), + field.enemyGoalCenter(), + field.enemyDefenseArea().negXNegYCorner(), + field.enemyDefenseArea().negXPosYCorner(), + ], + ball_location=destination, + ball_velocity=tbots_cpp.Vector(0, 0), + ), + ) + + gameplay_test_runner.set_tactics( + blue_tactics={ + 0: MoveTactic( + destination=tbots_cpp.createPointProto(destination), + final_orientation=tbots_cpp.createAngleProto( + tbots_cpp.Angle.threeQuarter() + ), + dribbler_mode=DribblerMode.OFF, + ball_collision_type=BallCollisionType.ALLOW, + auto_chip_or_kick=AutoChipOrKick(autokick_speed_m_per_s=3.0), + max_allowed_speed_mode=MaxAllowedSpeedMode.COLLISIONS_ALLOWED, + obstacle_avoidance_mode=ObstacleAvoidanceMode.SAFE, + ) + } + ) + + eventually_validation_sequence_set = [ + [ + # Robot moves to destination and kicks + RobotEventuallyAtPosition(0, destination), + BallEventuallyKickedInDirection(tbots_cpp.Angle.threeQuarter()), + # Robot stays at destination for one second + DurationValidation( + duration_s=1, validation=RobotEventuallyAtPosition(0, destination) + ), + ] + ] + + gameplay_test_runner.run_test( + setup=setup, + inv_eventually_validation_sequence_set=eventually_validation_sequence_set, + ag_eventually_validation_sequence_set=eventually_validation_sequence_set, + test_timeout_s=5, + ) + + +@pytest.mark.parametrize( + "orientation, initial_position, destination, angular_velocity", + [ + # Robot facing right, should rotate counter clockwise to face up + ( + tbots_cpp.Angle.quarter(), + tbots_cpp.Point(2, 0), + tbots_cpp.Point(-2, 0), + tbots_cpp.Angle.fromDegrees(360), + ), + # Robot facing right, should rotate clockwise to face down + ( + tbots_cpp.Angle.threeQuarter(), + tbots_cpp.Point(2, 0), + tbots_cpp.Point(-2, 0), + tbots_cpp.Angle.fromDegrees(-360), + ), + # Robot facing right, should rotate counter clockwise to face up + ( + tbots_cpp.Angle.quarter(), + tbots_cpp.Point(0, 0), + tbots_cpp.Point(0, 0), + tbots_cpp.Angle.fromDegrees(360), + ), + # Robot facing right, should rotate clockwise to face down + ( + tbots_cpp.Angle.threeQuarter(), + tbots_cpp.Point(0, 0), + tbots_cpp.Point(0, 0), + tbots_cpp.Angle.fromDegrees(-360), + ), + # Robot facing right, should rotate counter clockwise to face left, slightly up + ( + tbots_cpp.Angle.fromDegrees(175), + tbots_cpp.Point(3, -1), + tbots_cpp.Point(0, 1), + tbots_cpp.Angle.fromDegrees(360), + ), + # Robot facing right, should rotate clockwise to face down + ( + tbots_cpp.Angle.fromDegrees(185), + tbots_cpp.Point(3, -1), + tbots_cpp.Point(0, 1), + tbots_cpp.Angle.fromDegrees(-360), + ), + ], +) +def test_spinning_move( + orientation, initial_position, destination, angular_velocity, gameplay_test_runner +): + def setup(*args): + gameplay_test_runner.set_world_state( + create_world_state( + blue_robot_locations=[initial_position], + yellow_robot_locations=[tbots_cpp.Point(4, 0)], + ball_location=tbots_cpp.Point(1, 1), + ball_velocity=tbots_cpp.Vector(0, 0), + ), + ) + + gameplay_test_runner.set_tactics( + blue_tactics={ + 0: MoveTactic( + destination=tbots_cpp.createPointProto(destination), + final_orientation=tbots_cpp.createAngleProto(orientation), + dribbler_mode=DribblerMode.OFF, + ball_collision_type=BallCollisionType.ALLOW, + auto_chip_or_kick=AutoChipOrKick(), + max_allowed_speed_mode=MaxAllowedSpeedMode.PHYSICAL_LIMIT, + obstacle_avoidance_mode=ObstacleAvoidanceMode.SAFE, + ) + } + ) + + eventually_validation_sequence_set = [ + [ + # High threshold to check direction of angular velocity + RobotEventuallyAtAngularVelocity(0, angular_velocity, 4), + # Robot stays at destination for one second + DurationValidation( + duration_s=1, validation=RobotEventuallyAtPosition(0, destination) + ), + ], + [ + # Robot stays at orientation for one second once it has reached the destination + RobotEventuallyAtPosition(0, destination), + DurationValidation( + duration_s=1, validation=RobotEventuallyAtOrientation(0, orientation) + ), + ], + ] + + gameplay_test_runner.run_test( + setup=setup, + inv_eventually_validation_sequence_set=eventually_validation_sequence_set, + ag_eventually_validation_sequence_set=eventually_validation_sequence_set, + test_timeout_s=5, + ) if __name__ == "__main__": From 71647b1c96ec7a79efd8ad304ae185070fc12679 Mon Sep 17 00:00:00 2001 From: Eric Xiao Date: Tue, 26 May 2026 17:25:08 -0700 Subject: [PATCH 05/18] Formatting --- src/software/ai/hl/stp/tactic/move/BUILD | 2 +- .../ai/hl/stp/tactic/penalty_kick/penalty_kick_tactic_test.py | 4 +--- src/software/conftest.py | 2 +- src/software/field_tests/BUILD | 4 ++-- src/software/gameplay_tests/util.py | 1 - 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/software/ai/hl/stp/tactic/move/BUILD b/src/software/ai/hl/stp/tactic/move/BUILD index 5ee4f5f696..3b04ab038d 100644 --- a/src/software/ai/hl/stp/tactic/move/BUILD +++ b/src/software/ai/hl/stp/tactic/move/BUILD @@ -38,8 +38,8 @@ py_test( ], deps = [ "//software:conftest", - "//software/gameplay_tests/validation:validations", "//software/gameplay_tests:util", + "//software/gameplay_tests/validation:validations", requirement("pytest"), ], ) diff --git a/src/software/ai/hl/stp/tactic/penalty_kick/penalty_kick_tactic_test.py b/src/software/ai/hl/stp/tactic/penalty_kick/penalty_kick_tactic_test.py index 82ea9b42bb..c319103343 100644 --- a/src/software/ai/hl/stp/tactic/penalty_kick/penalty_kick_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/penalty_kick/penalty_kick_tactic_test.py @@ -51,9 +51,7 @@ @pytest.mark.skip( "Disabling this test because of poor dribbling controls, does not consistently score goal. TODO (#2232)" ) -def test_penalty_kick( - enemy_robot_location, enemy_robot_velocity, gameplay_test_runner -): +def test_penalty_kick(enemy_robot_location, enemy_robot_velocity, gameplay_test_runner): field = tbots_cpp.Field.createSSLDivisionBField() ball_initial_pos = field.friendlyPenaltyMark() diff --git a/src/software/conftest.py b/src/software/conftest.py index af7629159b..9061532c9e 100644 --- a/src/software/conftest.py +++ b/src/software/conftest.py @@ -1,6 +1,6 @@ import pytest # noqa: F401 from software.field_tests.field_test_fixture import field_test_runner # noqa: F401 -from software.gameplay_tests.fixture import gameplay_test_runner +from software.gameplay_tests.fixture import gameplay_test_runner # noqa: F401 # Pytest requires that all tests fixtures shared across a package be defined # in a single conftest.py file in the parent directory of the package. diff --git a/src/software/field_tests/BUILD b/src/software/field_tests/BUILD index 482d08e15c..468cde30b0 100644 --- a/src/software/field_tests/BUILD +++ b/src/software/field_tests/BUILD @@ -12,11 +12,11 @@ py_library( ], deps = [ "//proto:import_all_protos", + "//software/gameplay_tests:tbots_test_runner", + "//software/gameplay_tests/validation:validations", "//software/logger:py_logger", "//software/networking/unix:threaded_unix_listener_py", "//software/networking/unix:threaded_unix_sender_py", - "//software/gameplay_tests:tbots_test_runner", - "//software/gameplay_tests/validation:validations", "//software/thunderscope", "//software/thunderscope:constants", "//software/thunderscope:estop_helpers", diff --git a/src/software/gameplay_tests/util.py b/src/software/gameplay_tests/util.py index b35fb44c07..9f381b3e24 100644 --- a/src/software/gameplay_tests/util.py +++ b/src/software/gameplay_tests/util.py @@ -12,7 +12,6 @@ def load_command_line_arguments(allow_unrecognized: bool = False): :param allow_unrecognized: if true, does not raise an error for unrecognized arguments """ - # TODO: add field test specific flags parser = argparse.ArgumentParser(description="Run simulated pytests") From 3d36d1268677306c6eb28c5334f806afd722e2dd Mon Sep 17 00:00:00 2001 From: Eric Xiao Date: Tue, 26 May 2026 21:53:38 -0700 Subject: [PATCH 06/18] Add missing BUILD file some reason its gitignored by default --- src/software/gameplay_tests/BUILD | 63 +++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 src/software/gameplay_tests/BUILD diff --git a/src/software/gameplay_tests/BUILD b/src/software/gameplay_tests/BUILD new file mode 100644 index 0000000000..0e16407589 --- /dev/null +++ b/src/software/gameplay_tests/BUILD @@ -0,0 +1,63 @@ +load("@rules_python//python:pip.bzl", "compile_pip_requirements") +load("@gameplay_tests_deps//:requirements.bzl", "requirement") + +package(default_visibility = ["//visibility:public"]) + +compile_pip_requirements( + name = "requirements", + src = "requirements.in", + requirements_txt = "requirements_lock.txt", +) + +py_library( + name = "fixture", + srcs = [ + "fixture.py", + ], + deps = [ + ":util", + ":simulated_test_runner", + "//software/thunderscope:thunderscope", + "//software/thunderscope/binary_context_managers:full_system", + "//software/thunderscope/binary_context_managers:game_controller", + "//software/thunderscope/binary_context_managers:simulator", + requirement("pytest"), + ], +) + +py_library( + name = "tbots_test_runner", + srcs = [ + "tbots_test_runner.py", + ], + deps = [ + "//proto:import_all_protos", + "//software/logger:py_logger", + "//software/networking/unix:threaded_unix_listener_py", + "//software/networking/unix:threaded_unix_sender_py", + "//software/gameplay_tests/validation:validations", + "//software/thunderscope:thunderscope", + "//software/thunderscope:config", + "//software/thunderscope:constants", + "//software/thunderscope:time_provider", + "//software/thunderscope/binary_context_managers:full_system", + "//software/thunderscope/binary_context_managers:game_controller", + "//software/thunderscope/binary_context_managers:simulator", + ], +) + +py_library( + name = "simulated_test_runner", + srcs = [ + "simulated_test_runner.py", + ], + deps = [], +) + +py_library( + name = "util", + srcs = [ + "util.py", + ], + deps = [], +) From 3452ceb53ca414ba85a2fb5fe0cb04c9a7433284 Mon Sep 17 00:00:00 2001 From: Eric Xiao Date: Tue, 26 May 2026 22:57:56 -0700 Subject: [PATCH 07/18] Fix simulated hrvo test imports --- src/software/ai/navigator/trajectory/simulated_hrvo_test.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/software/ai/navigator/trajectory/simulated_hrvo_test.py b/src/software/ai/navigator/trajectory/simulated_hrvo_test.py index 502abe50de..7057c0456f 100644 --- a/src/software/ai/navigator/trajectory/simulated_hrvo_test.py +++ b/src/software/ai/navigator/trajectory/simulated_hrvo_test.py @@ -9,7 +9,6 @@ import math from proto.import_all_protos import * from proto.ssl_gc_common_pb2 import Team -from software.gameplay_tests.util import SimulatedTestRunner from software.gameplay_tests.validation.validation import ( create_validation_types, create_validation_geometry, @@ -168,7 +167,7 @@ def hrvo_setup( friendly_robots_final_orientations: list[tbots.Angle], enemy_robots_positions: list[tbots.Point], enemy_robots_destinations: list[tbots.Point], - gameplay_test_runner: SimulatedTestRunner, + gameplay_test_runner, ): """Setup for the hrvo tests @@ -472,7 +471,7 @@ def hrvo_setup( ], ) def test_robot_movement( - gameplay_test_runner: SimulatedTestRunner, + gameplay_test_runner, friendly_robot_positions: list[tbots.Point], friendly_robot_destinations: list[tbots.Point], friendly_robots_final_orientations: list[tbots.Angle], From 8631603613583fa15c42d008c15737bbe3ca8606 Mon Sep 17 00:00:00 2001 From: Eric Xiao Date: Sat, 30 May 2026 13:59:45 -0700 Subject: [PATCH 08/18] Add cli argument groups for general tests, simulated and field --- src/software/gameplay_tests/util.py | 121 ++++++++++++++++++++-------- 1 file changed, 88 insertions(+), 33 deletions(-) diff --git a/src/software/gameplay_tests/util.py b/src/software/gameplay_tests/util.py index 9f381b3e24..7d7f984fac 100644 --- a/src/software/gameplay_tests/util.py +++ b/src/software/gameplay_tests/util.py @@ -1,4 +1,5 @@ import argparse +import os import sys import pytest @@ -12,85 +13,139 @@ def load_command_line_arguments(allow_unrecognized: bool = False): :param allow_unrecognized: if true, does not raise an error for unrecognized arguments """ - # TODO: add field test specific flags + parser = argparse.ArgumentParser( + description="Run simulated or field gameplay tests" + ) - parser = argparse.ArgumentParser(description="Run simulated pytests") - parser.add_argument( - "--enable_thunderscope", action="store_true", help="enable thunderscope" + general_group = parser.add_argument_group("General test arguments") + general_group.add_argument( + "--run_field_test", + action="store_true", + default=False, + help="Runs test as a field test instead of a simulated test", ) - parser.add_argument( - "--aggregate", action="store_true", default=False, help="Run aggregate test" + general_group.add_argument( + "--enable_thunderscope", action="store_true", help="enable thunderscope" ) - parser.add_argument( - "--simulator_runtime_dir", - type=str, - help="simulator runtime directory", - default="/tmp/tbots", + general_group.add_argument( + "--test_filter", + action="store", + default="", + help="The test filter, if not specified all tests will run. " + + "See https://docs.pytest.org/en/latest/how-to/usage.html#specifying-tests-selecting-tests", ) - parser.add_argument( + general_group.add_argument( "--blue_full_system_runtime_dir", type=str, help="blue full_system runtime directory", default="/tmp/tbots/blue", ) - parser.add_argument( + general_group.add_argument( "--yellow_full_system_runtime_dir", type=str, help="yellow full_system runtime directory", default="/tmp/tbots/yellow", ) - parser.add_argument( + general_group.add_argument( "--layout", action="store", help="Which layout to run, if not specified the last layout will run", ) - parser.add_argument( + general_group.add_argument( "--debug_blue_full_system", action="store_true", default=False, help="Debug blue full_system", ) - parser.add_argument( + general_group.add_argument( "--debug_yellow_full_system", action="store_true", default=False, help="Debug yellow full_system", ) - parser.add_argument( + general_group.add_argument( + "--show_gamecontroller_logs", + action="store_true", + default=False, + help="Show gamecontroller logs", + ) + + simulated_group = parser.add_argument_group("Simulated test arguments") + simulated_group.add_argument( + "--aggregate", action="store_true", default=False, help="Run aggregate test" + ) + simulated_group.add_argument( + "--simulator_runtime_dir", + type=str, + help="simulator runtime directory", + default="/tmp/tbots", + ) + simulated_group.add_argument( "--debug_simulator", action="store_true", default=False, help="Debug the simulator", ) - parser.add_argument( - "--visualization_buffer_size", + simulated_group.add_argument( + "--enable_realism", + action="store_true", + default=False, + help="Use realism in the simulator", + ) + + field_group = parser.add_argument_group("Field test arguments") + field_group.add_argument( + "--interface", + action="store", + type=str, + default=None, + help="Which interface to communicate over", + ) + field_group.add_argument( + "--channel", action="store", type=int, - default=5, - help="How many packets to buffer while rendering", + default=0, + help="Which channel to communicate over", ) - parser.add_argument( - "--show_gamecontroller_logs", + field_group.add_argument( + "--estop_baudrate", + action="store", + type=int, + default=115200, + help="Estop Baudrate", + ) + field_group.add_argument( + "--run_yellow", action="store_true", default=False, - help="Show gamecontroller logs", + help="Run the test with friendly robots in yellow mode", ) - parser.add_argument( - "--test_filter", - action="store", - default="", - help="The test filter, if not specified all tests will run. " - + "See https://docs.pytest.org/en/latest/how-to/usage.html#specifying-tests-selecting-tests", + + estop_group = field_group.add_mutually_exclusive_group() + estop_group.add_argument( + "--keyboard_estop", + action="store_true", + default=False, + help="Allows the use of the spacebar as an estop instead of a physical one", ) - parser.add_argument( - "--enable_realism", + estop_group.add_argument( + "--disable_communication", action="store_true", default=False, - help="Use realism in the simulator", + help="Disables checking for estop plugged in (ONLY USE FOR LOCAL TESTING)", ) + return parser.parse_known_args()[0] if allow_unrecognized else parser.parse_args() +def get_current_pytest(): + current_test = os.environ.get("PYTEST_CURRENT_TEST").split(":")[-1].split(" ")[0] + current_test = current_test.replace("]", "") + current_test = current_test.replace("[", "-") + return current_test + + def pytest_main(file): """Runs the pytest file From 2808eccbbe39af8ed306db8c957584ba84a38c6e Mon Sep 17 00:00:00 2001 From: Eric Xiao Date: Sat, 30 May 2026 14:00:11 -0700 Subject: [PATCH 09/18] Add field test runner to gameplay test fixture --- src/software/gameplay_tests/BUILD | 11 + .../gameplay_tests/field_test_runner.py | 191 ++++++++++++++++++ src/software/gameplay_tests/fixture.py | 157 ++++++++++++-- 3 files changed, 341 insertions(+), 18 deletions(-) create mode 100644 src/software/gameplay_tests/field_test_runner.py diff --git a/src/software/gameplay_tests/BUILD b/src/software/gameplay_tests/BUILD index 0e16407589..252002b354 100644 --- a/src/software/gameplay_tests/BUILD +++ b/src/software/gameplay_tests/BUILD @@ -16,7 +16,10 @@ py_library( ], deps = [ ":util", + ":field_test_runner", ":simulated_test_runner", + "//software/thunderscope:estop_helpers", + "//software/logger:py_logger", "//software/thunderscope:thunderscope", "//software/thunderscope/binary_context_managers:full_system", "//software/thunderscope/binary_context_managers:game_controller", @@ -46,6 +49,14 @@ py_library( ], ) +py_library( + name = "field_test_runner", + srcs = [ + "field_test_runner.py", + ], + deps = [], +) + py_library( name = "simulated_test_runner", srcs = [ diff --git a/src/software/gameplay_tests/field_test_runner.py b/src/software/gameplay_tests/field_test_runner.py new file mode 100644 index 0000000000..246ca8267f --- /dev/null +++ b/src/software/gameplay_tests/field_test_runner.py @@ -0,0 +1,191 @@ +import queue +import time +import threading + +import pytest +from proto.import_all_protos import * + +from software.gameplay_tests.validation import validation +from software.logger.logger import create_logger + + +from software.gameplay_tests.tbots_test_runner import TbotsTestRunner +from software.py_constants import * +from typing import override + +logger = create_logger(__name__) + +WORLD_BUFFER_TIMEOUT = 5.0 +PROCESS_BUFFER_DELAY_S = 0.01 +PAUSE_AFTER_FAIL_DELAY_S = 3 +LAUNCH_DELAY_S = 0.1 +TEST_END_DELAY = 0.3 + + +class FieldTestRunner(TbotsTestRunner): + """Run a field test""" + + def __init__( + self, + test_name, + thunderscope, + blue_full_system_proto_unix_io, + yellow_full_system_proto_unix_io, + gamecontroller, + publish_validation_protos=True, + is_yellow_friendly=False, + ): + """Initialize the FieldTestRunner + + :param test_name: The name of the test to run + :param thunderscope: The Thunderscope to use, None if not used + :param blue_full_system_proto_unix_io: The blue full system proto unix io to use + :param yellow_full_system_proto_unix_io: The yellow full system proto unix io to use + :param gamecontroller: The gamecontroller context managed instance + :param publish_validation_protos: whether to publish validation protos + :param: is_yellow_friendly: if yellow is the friendly team + """ + super(FieldTestRunner, self).__init__( + test_name, + thunderscope, + blue_full_system_proto_unix_io, + yellow_full_system_proto_unix_io, + gamecontroller, + is_yellow_friendly, + ) + self.publish_validation_protos = publish_validation_protos + self.is_yellow_friendly = is_yellow_friendly + + logger.info("determining robots on field") + # survey field for available robot ids + try: + world = self.world_buffer.get(block=True, timeout=WORLD_BUFFER_TIMEOUT) + self.initial_world = world + self.friendly_robot_ids_field = [ + robot.id for robot in world.friendly_team.team_robots + ] + + logger.info(f"friendly team ids {self.friendly_robot_ids_field}") + + if len(self.friendly_robot_ids_field) == 0: + raise Exception("no friendly robots found on field") + + except queue.Empty: + raise Exception( + f"No Worlds were received with in {WORLD_BUFFER_TIMEOUT} seconds. Please make sure atleast 1 robot and 1 ball is present on the field." + ) + + @override + def send_gamecontroller_command( + self, + gc_command: proto.ssl_gc_state_pb2.Command, + team: proto.ssl_gc_common_pb2.Team, + final_ball_placement_point=None, + ): + """Send a command to the gamecontroller + + :param gc_command: The command to send + :param team: The team which the command as attributed to + :param final_ball_placement_point: The ball placement point + """ + self.gamecontroller.send_ci_input( + gc_command=gc_command, + team=team, + final_ball_placement_point=final_ball_placement_point, + ) + + @override + def run_test( + self, + always_validation_sequence_set=[[]], + eventually_validation_sequence_set=[[]], + test_timeout_s=3, + ): + """Run a test. In a field test this means beginning validation. + + :param always_validation_sequence_set: Validation functions that should + hold on every tick + :param eventually_validation_sequence_set: Validation that should + eventually be true, before the test ends + :param test_timeout_s: The timeout for the test, if any eventually_validations + remain after the timeout, the test fails. + """ + + def stop_test(delay): + time.sleep(delay) + if self.thunderscope: + self.thunderscope.close() + + def runner(): + time.sleep(LAUNCH_DELAY_S) + + test_end_time = time.time() + test_timeout_s + + while time.time() < test_end_time: + while True: + try: + world = self.world_buffer.get( + block=True, timeout=WORLD_BUFFER_TIMEOUT + ) + break + except queue.Empty: + # If we timeout, that means full_system missed the last + # wrapper and robot status, lets resend it. + logger.warning( + f"No World was received for {WORLD_BUFFER_TIMEOUT} seconds. Ending test early." + ) + + # Validate + ( + eventually_validation_proto_set, + always_validation_proto_set, + ) = validation.run_validation_sequence_sets( + world, + eventually_validation_sequence_set, + always_validation_sequence_set, + ) + + if self.publish_validation_protos: + # Set the test name + eventually_validation_proto_set.test_name = self.test_name + always_validation_proto_set.test_name = self.test_name + + # Send out the validation proto to thunderscope + self.blue_full_system_proto_unix_io.send_proto( + ValidationProtoSet, eventually_validation_proto_set + ) + self.blue_full_system_proto_unix_io.send_proto( + ValidationProtoSet, always_validation_proto_set + ) + + # Check that all always validations are always valid + validation.check_validation(always_validation_proto_set) + + # Check that all eventually validations are eventually valid + validation.check_validation(eventually_validation_proto_set) + stop_test(TEST_END_DELAY) + + def excepthook(args): + """This function is _critical_ for show_thunderscope to work. + If the test Thread will raises an exception we won't be able to close + the window from the main thread. + + :param args: The args passed in from the hook + """ + stop_test(delay=PAUSE_AFTER_FAIL_DELAY_S) + self.last_exception = args.exc_value + raise self.last_exception + + threading.excepthook = excepthook + + if self.thunderscope: + run_test_thread = threading.Thread(target=runner, daemon=True) + run_test_thread.start() + self.thunderscope.show() + run_test_thread.join() + + if self.last_exception: + pytest.fail(str(ex.last_exception)) + + else: + runner() diff --git a/src/software/gameplay_tests/fixture.py b/src/software/gameplay_tests/fixture.py index 2e08750267..bec8cdb193 100644 --- a/src/software/gameplay_tests/fixture.py +++ b/src/software/gameplay_tests/fixture.py @@ -1,48 +1,163 @@ -import os import time import pytest +from software.py_constants import ( + MAX_ROBOT_IDS_PER_SIDE, + SSL_REFEREE_PORT, + getRobotMulticastChannel, +) -from software.gameplay_tests.util import load_command_line_arguments +from proto.import_all_protos import World +from software.gameplay_tests.field_test_runner import FieldTestRunner from software.gameplay_tests.simulated_test_runner import ( - InvariantTestRunner, AggregateTestRunner, + InvariantTestRunner, ) +from software.gameplay_tests.util import get_current_pytest, load_command_line_arguments +from software.logger.logger import create_logger from software.thunderscope.binary_context_managers.full_system import FullSystem from software.thunderscope.binary_context_managers.game_controller import Gamecontroller from software.thunderscope.binary_context_managers.simulator import Simulator +from software.thunderscope.constants import EstopMode, IndividualRobotMode +from software.thunderscope.estop_helpers import get_estop_config from software.thunderscope.proto_unix_io import ProtoUnixIO +from software.thunderscope.robot_communication import RobotCommunication from software.thunderscope.thunderscope import Thunderscope -from software.thunderscope.thunderscope_config import configure_simulated_test_view +from software.thunderscope.thunderscope_config import ( + configure_field_test_view, + configure_simulated_test_view, +) +from software.thunderscope.wifi_communication_manager import WifiCommunicationManager + +logger = create_logger(__name__) LAUNCH_DELAY_S = 0.1 @pytest.fixture def gameplay_test_runner(): - args = load_command_line_arguments() - tscope = None + args = load_command_line_arguments(allow_unrecognized=True) + + if args.run_field_test: + yield from create_field_test_runner(args) + else: + yield from create_simulated_test_runner(args) - aggregate = args.aggregate + +def create_field_test_runner(args): + # Grab the current test name to store the proto log for the test case + current_test = get_current_pytest() + test_name = get_current_pytest().split("-")[0] simulator_proto_unix_io = ProtoUnixIO() yellow_full_system_proto_unix_io = ProtoUnixIO() blue_full_system_proto_unix_io = ProtoUnixIO() - # Grab the current test name to store the proto log for the test case - current_test = os.environ.get("PYTEST_CURRENT_TEST").split(":")[-1].split(" ")[0] - current_test = current_test.replace("]", "") - current_test = current_test.replace("[", "-") + runtime_dir = f"{args.blue_full_system_runtime_dir}/test/{test_name}" + friendly_proto_unix_io = blue_full_system_proto_unix_io - test_name = current_test.split("-")[0] + if args.run_yellow: + debug_full_sys = args.debug_yellow_full_system + runtime_dir = f"{args.yellow_full_system_runtime_dir}/test/{test_name}" + friendly_proto_unix_io = yellow_full_system_proto_unix_io + + estop_mode, estop_path = get_estop_config( + args.keyboard_estop, args.disable_communication + ) # Launch all binaries with ( - Simulator( - f"{args.simulator_runtime_dir}/test/{test_name}", - args.debug_simulator, - args.enable_realism, - ) as simulator, + FullSystem( + "software/unix_full_system", + full_system_runtime_dir=runtime_dir, + debug_full_system=debug_full_sys, + friendly_colour_yellow=args.run_yellow, + should_restart_on_crash=False, + ) as friendly_fs, + Gamecontroller( + # we would be using conventional port if and only if we are playing in robocup. + suppress_logs=(not args.show_gamecontroller_logs), + use_conventional_port=False, + ) as gamecontroller, + WifiCommunicationManager( + current_proto_unix_io=friendly_proto_unix_io, + multicast_channel=getRobotMulticastChannel(args.channel), + should_setup_full_system=True, + interface=args.interface, + referee_port=gamecontroller.get_referee_port() + if gamecontroller + else SSL_REFEREE_PORT, + ) as wifi_communication_manager, + RobotCommunication( + current_proto_unix_io=friendly_proto_unix_io, + communication_manager=wifi_communication_manager, + estop_mode=estop_mode, + estop_path=estop_path, + ) as rc_friendly, + ): + friendly_fs.setup_proto_unix_io(friendly_proto_unix_io) + + gamecontroller.setup_proto_unix_io( + blue_full_system_proto_unix_io=blue_full_system_proto_unix_io, + yellow_full_system_proto_unix_io=yellow_full_system_proto_unix_io, + simulator_proto_unix_io=simulator_proto_unix_io, + ) + # Inject the proto unix ios into thunderscope and start the test + tscope = Thunderscope( + configure_field_test_view( + simulator_proto_unix_io=simulator_proto_unix_io, + blue_full_system_proto_unix_io=blue_full_system_proto_unix_io, + yellow_full_system_proto_unix_io=yellow_full_system_proto_unix_io, + yellow_is_friendly=args.run_yellow, + ), + layout_path=None, + ) + + # Set control mode for all robots to AI so that packets are sent to the robots + for robot_id in range(MAX_ROBOT_IDS_PER_SIDE): + rc_friendly.toggle_individual_robot_control_mode( + robot_id, + IndividualRobotMode.AI, + ) + + # connect the keyboard estop toggle to the key event if needed + if estop_mode == EstopMode.KEYBOARD_ESTOP: + tscope.keyboard_estop_shortcut.activated.connect( + rc_friendly.toggle_keyboard_estop + ) + # we call this method to enable estop automatically when a field test starts + rc_friendly.toggle_keyboard_estop() + logger.warning( + "\x1b[31;20m" + + "Keyboard Estop Enabled, robots will start moving automatically when test starts!" + + "\x1b[0m" + ) + + time.sleep(LAUNCH_DELAY_S) + runner = FieldTestRunner( + test_name=current_test, + blue_full_system_proto_unix_io=blue_full_system_proto_unix_io, + yellow_full_system_proto_unix_io=yellow_full_system_proto_unix_io, + gamecontroller=gamecontroller, + thunderscope=tscope, + is_yellow_friendly=args.run_yellow, + ) + + friendly_proto_unix_io.register_observer(World, runner.world_buffer) + + yield runner + + +def create_simulated_test_runner(args): + # Grab the current test name to store the proto log for the test case + current_test = get_current_pytest() + test_name = get_current_pytest().split("-")[0] + + simulator_proto_unix_io = ProtoUnixIO() + yellow_full_system_proto_unix_io = ProtoUnixIO() + blue_full_system_proto_unix_io = ProtoUnixIO() + + with ( FullSystem( "software/unix_full_system", f"{args.blue_full_system_runtime_dir}/test/{test_name}", @@ -59,6 +174,11 @@ def gameplay_test_runner(): should_restart_on_crash=False, running_in_realtime=args.enable_thunderscope, ) as yellow_fs, + Simulator( + f"{args.simulator_runtime_dir}/test/{test_name}", + args.debug_simulator, + args.enable_realism, + ) as simulator, ): with Gamecontroller( suppress_logs=(not args.show_gamecontroller_logs) @@ -79,6 +199,7 @@ def gameplay_test_runner(): # If we want to run thunderscope, inject the proto unix ios # and start the test + tscope = None if args.enable_thunderscope: tscope = Thunderscope( configure_simulated_test_view( @@ -94,7 +215,7 @@ def gameplay_test_runner(): runner = None # Initialise the right runner based on which testing mode is selected - if aggregate: + if args.aggregate: runner = AggregateTestRunner( current_test, tscope, From 163e0f214cd758949aab41e6cc036d3eea312273 Mon Sep 17 00:00:00 2001 From: Eric Xiao Date: Sat, 30 May 2026 14:00:35 -0700 Subject: [PATCH 10/18] Rewrite field test in style of simulated test --- src/software/field_tests/BUILD | 2 +- .../field_tests/movement_robot_field_test.py | 226 +++++++++--------- 2 files changed, 114 insertions(+), 114 deletions(-) diff --git a/src/software/field_tests/BUILD b/src/software/field_tests/BUILD index 468cde30b0..dd3704069d 100644 --- a/src/software/field_tests/BUILD +++ b/src/software/field_tests/BUILD @@ -38,7 +38,7 @@ py_test( ], deps = [ "//software:conftest", - "//software/gameplay_tests:tbots_test_runner", + "//software/gameplay_tests:util", "//software/gameplay_tests/validation:validations", requirement("pytest"), ], diff --git a/src/software/field_tests/movement_robot_field_test.py b/src/software/field_tests/movement_robot_field_test.py index a9decc3998..1da87720b2 100644 --- a/src/software/field_tests/movement_robot_field_test.py +++ b/src/software/field_tests/movement_robot_field_test.py @@ -1,14 +1,17 @@ -from proto.import_all_protos import * -from software.field_tests.field_test_fixture import * +import math -from software.gameplay_tests.util import * +import pytest +import software.python_bindings as tbots_cpp + +from proto.import_all_protos import * +from proto.message_translation.tbots_protobuf import create_world_state +from software.gameplay_tests.util import pytest_main from software.logger.logger import create_logger -import math logger = create_logger(__name__) -# TODO 2908: Support running this test in both simulator or field mode +# TODO(#2908): Support running this test in both simulator or field mode # this test can be run either in simulation or on the field # @pytest.mark.parametrize( # "robot_x_destination, robot_y_destination", @@ -66,66 +69,102 @@ # test_timeout_s=5, # ) - +# TODO(#2908): uncomment this # this test can only be run on the field -def test_basic_rotation(field_test_runner): - test_angles = [0, 45, 90, 180, 270, 0] - - world = field_test_runner.world_buffer.get(block=True, timeout=WORLD_BUFFER_TIMEOUT) - if len(world.friendly_team.team_robots) == 0: - raise Exception("The first world received had no robots in it!") - - print("Here are the robots:") - print( - [ - robot.current_state.global_position - for robot in world.friendly_team.team_robots - ] +# def test_basic_rotation(field_test_runner): +# test_angles = [0, 45, 90, 180, 270, 0] +# +# world = field_test_runner.world_buffer.get(block=True, timeout=WORLD_BUFFER_TIMEOUT) +# if len(world.friendly_team.team_robots) == 0: +# raise Exception("The first world received had no robots in it!") +# +# print("Here are the robots:") +# print( +# [ +# robot.current_state.global_position +# for robot in world.friendly_team.team_robots +# ] +# ) +# +# id = world.friendly_team.team_robots[0].id +# print(f"Running test on robot {id}") +# +# robot = world.friendly_team.team_robots[0] +# rob_pos_p = robot.current_state.global_position +# logger.info("staying in pos {rob_pos_p}") +# +# for angle in test_angles: +# move_tactic = MoveTactic() +# move_tactic.destination.CopyFrom(rob_pos_p) +# move_tactic.dribbler_mode = DribblerMode.OFF +# move_tactic.final_orientation.CopyFrom(Angle(radians=angle)) +# move_tactic.ball_collision_type = BallCollisionType.AVOID +# move_tactic.auto_chip_or_kick.CopyFrom( +# AutoChipOrKick(autokick_speed_m_per_s=0.0) +# ) +# move_tactic.max_allowed_speed_mode = MaxAllowedSpeedMode.PHYSICAL_LIMIT +# move_tactic.obstacle_avoidance_mode = ObstacleAvoidanceMode.SAFE +# +# # Setup Tactic +# field_test_runner.set_tactics( +# blue_tactics={id: move_tactic}, yellow_tactics=None +# ) +# field_test_runner.run_test( +# always_validation_sequence_set=[[]], +# eventually_validation_sequence_set=[[]], +# test_timeout_s=5, +# ) +# # Send a halt tactic after the test finishes +# field_test_runner.set_tactics( +# blue_tactics={id: HaltTactic()}, yellow_tactics=None +# ) +# +# # validate by eye +# logger.info(f"robot set to {angle} orientation") +# +# time.sleep(2) + + +@pytest.mark.parametrize( + "start_position, end_position", + [ + ( + tbots_cpp.Point(-1.5, 0.6), + tbots_cpp.Point(-0.3, 0.6), + ), + ( + tbots_cpp.Point(-0.3, 0.6), + tbots_cpp.Point(-0.3, -0.6), + ), + ( + tbots_cpp.Point(-0.3, -0.6), + tbots_cpp.Point(-1.5, -0.6), + ), + ( + tbots_cpp.Point(-1.5, -0.6), + tbots_cpp.Point(-1.5, 0.6), + ), + ], +) +def test_one_robots_square(start_position, end_position, gameplay_test_runner): + gameplay_test_runner.set_world_state( + create_world_state( + blue_robot_locations=[ + start_position, + ], + yellow_robot_locations=[], + ball_location=tbots_cpp.Point(0, 0), + ball_velocity=tbots_cpp.Vector(0, 0), + ), ) + world = gameplay_test_runner.world_buffer.get(block=True, timeout=5.0) + while len(world.friendly_team.team_robots) == 0: + tick = SimulatorTick(milliseconds=1000 / 60) + gameplay_test_runner.simulator_proto_unix_io.send_proto(SimulatorTick, tick) - id = world.friendly_team.team_robots[0].id - print(f"Running test on robot {id}") - - robot = world.friendly_team.team_robots[0] - rob_pos_p = robot.current_state.global_position - logger.info("staying in pos {rob_pos_p}") - - for angle in test_angles: - move_tactic = MoveTactic() - move_tactic.destination.CopyFrom(rob_pos_p) - move_tactic.dribbler_mode = DribblerMode.OFF - move_tactic.final_orientation.CopyFrom(Angle(radians=angle)) - move_tactic.ball_collision_type = BallCollisionType.AVOID - move_tactic.auto_chip_or_kick.CopyFrom( - AutoChipOrKick(autokick_speed_m_per_s=0.0) - ) - move_tactic.max_allowed_speed_mode = MaxAllowedSpeedMode.PHYSICAL_LIMIT - move_tactic.obstacle_avoidance_mode = ObstacleAvoidanceMode.SAFE - - # Setup Tactic - field_test_runner.set_tactics( - blue_tactics={id: move_tactic}, yellow_tactics=None - ) - field_test_runner.run_test( - always_validation_sequence_set=[[]], - eventually_validation_sequence_set=[[]], - test_timeout_s=5, - ) - # Send a halt tactic after the test finishes - field_test_runner.set_tactics( - blue_tactics={id: HaltTactic()}, yellow_tactics=None - ) - - # validate by eye - logger.info(f"robot set to {angle} orientation") - - time.sleep(2) - - -def test_one_robots_square(field_test_runner): - world = field_test_runner.world_buffer.get(block=True, timeout=WORLD_BUFFER_TIMEOUT) - if len(world.friendly_team.team_robots) == 0: - raise Exception("The first world received had no robots in it!") + world = gameplay_test_runner.world_buffer.get(block=True, timeout=5.0) + print("The first world received had no robots in it!") + # raise Exception("The first world received had no robots in it!") print("Here are the robots:") print( @@ -138,13 +177,8 @@ def test_one_robots_square(field_test_runner): id = world.friendly_team.team_robots[0].id print(f"Running test on robot {id}") - point1 = Point(x_meters=-0.3, y_meters=0.6) - point2 = Point(x_meters=-0.3, y_meters=-0.6) - point3 = Point(x_meters=-1.5, y_meters=-0.6) - point4 = Point(x_meters=-1.5, y_meters=0.6) - - tactic_0 = MoveTactic( - destination=point1, + tactic = MoveTactic( + destination=tbots_cpp.createPointProto(end_position), dribbler_mode=DribblerMode.OFF, final_orientation=Angle(radians=-math.pi / 2), ball_collision_type=BallCollisionType.AVOID, @@ -152,52 +186,18 @@ def test_one_robots_square(field_test_runner): max_allowed_speed_mode=MaxAllowedSpeedMode.PHYSICAL_LIMIT, obstacle_avoidance_mode=ObstacleAvoidanceMode.SAFE, ) - tactic_1 = MoveTactic( - destination=point2, - dribbler_mode=DribblerMode.OFF, - final_orientation=Angle(radians=-math.pi / 2), - ball_collision_type=BallCollisionType.AVOID, - auto_chip_or_kick=AutoChipOrKick(autokick_speed_m_per_s=0.0), - max_allowed_speed_mode=MaxAllowedSpeedMode.PHYSICAL_LIMIT, - obstacle_avoidance_mode=ObstacleAvoidanceMode.SAFE, - ) - tactic_2 = MoveTactic( - destination=point3, - dribbler_mode=DribblerMode.OFF, - final_orientation=Angle(radians=-math.pi / 2), - ball_collision_type=BallCollisionType.AVOID, - auto_chip_or_kick=AutoChipOrKick(autokick_speed_m_per_s=0.0), - max_allowed_speed_mode=MaxAllowedSpeedMode.PHYSICAL_LIMIT, - obstacle_avoidance_mode=ObstacleAvoidanceMode.SAFE, + + print(f"Going to {tactic.destination}") + + gameplay_test_runner.set_tactics( + blue_tactics={ + id: tactic, + }, ) - tactic_3 = MoveTactic( - destination=point4, - dribbler_mode=DribblerMode.OFF, - final_orientation=Angle(radians=-math.pi / 2), - ball_collision_type=BallCollisionType.AVOID, - auto_chip_or_kick=AutoChipOrKick(autokick_speed_m_per_s=0.0), - max_allowed_speed_mode=MaxAllowedSpeedMode.PHYSICAL_LIMIT, - obstacle_avoidance_mode=ObstacleAvoidanceMode.SAFE, + + gameplay_test_runner.run_test( + test_timeout_s=4, ) - tactics = [tactic_0, tactic_1, tactic_2, tactic_3] - - for tactic in tactics: - print(f"Going to {tactic.destination}") - - field_test_runner.set_tactics( - blue_tactics={ - id: tactic, - }, - yellow_tactics=None, - ) - field_test_runner.run_test( - always_validation_sequence_set=[[]], - eventually_validation_sequence_set=[[]], - test_timeout_s=4, - ) - - # Send a halt tactic after the test finishes - field_test_runner.set_tactics(blue_tactics={id: HaltTactic()}, yellow_tactics=None) if __name__ == "__main__": From cee084fbfa3fa9f51df4de7179d9458b8700d5f8 Mon Sep 17 00:00:00 2001 From: Eric Xiao Date: Sat, 30 May 2026 15:04:25 -0700 Subject: [PATCH 11/18] Remove aggregate test runner --- .../gameplay_tests/field_test_runner.py | 19 +- src/software/gameplay_tests/fixture.py | 34 +-- .../gameplay_tests/simulated_test_runner.py | 236 ++++++------------ .../gameplay_tests/tbots_test_runner.py | 6 +- src/software/gameplay_tests/util.py | 3 - 5 files changed, 86 insertions(+), 212 deletions(-) diff --git a/src/software/gameplay_tests/field_test_runner.py b/src/software/gameplay_tests/field_test_runner.py index 246ca8267f..9e4c051a60 100644 --- a/src/software/gameplay_tests/field_test_runner.py +++ b/src/software/gameplay_tests/field_test_runner.py @@ -76,23 +76,12 @@ def __init__( ) @override - def send_gamecontroller_command( - self, - gc_command: proto.ssl_gc_state_pb2.Command, - team: proto.ssl_gc_common_pb2.Team, - final_ball_placement_point=None, - ): - """Send a command to the gamecontroller + def set_world_state(self, world_state: WorldState): + """Does nothing... TODO - :param gc_command: The command to send - :param team: The team which the command as attributed to - :param final_ball_placement_point: The ball placement point + :param world_state: The WorldState proto to use """ - self.gamecontroller.send_ci_input( - gc_command=gc_command, - team=team, - final_ball_placement_point=final_ball_placement_point, - ) + pass @override def run_test( diff --git a/src/software/gameplay_tests/fixture.py b/src/software/gameplay_tests/fixture.py index bec8cdb193..2a218b9000 100644 --- a/src/software/gameplay_tests/fixture.py +++ b/src/software/gameplay_tests/fixture.py @@ -9,10 +9,7 @@ from proto.import_all_protos import World from software.gameplay_tests.field_test_runner import FieldTestRunner -from software.gameplay_tests.simulated_test_runner import ( - AggregateTestRunner, - InvariantTestRunner, -) +from software.gameplay_tests.simulated_test_runner import SimulatedTestRunner from software.gameplay_tests.util import get_current_pytest, load_command_line_arguments from software.logger.logger import create_logger from software.thunderscope.binary_context_managers.full_system import FullSystem @@ -212,26 +209,13 @@ def create_simulated_test_runner(args): time.sleep(LAUNCH_DELAY_S) - runner = None - - # Initialise the right runner based on which testing mode is selected - if args.aggregate: - runner = AggregateTestRunner( - current_test, - tscope, - simulator_proto_unix_io, - blue_full_system_proto_unix_io, - yellow_full_system_proto_unix_io, - gamecontroller, - ) - else: - runner = InvariantTestRunner( - current_test, - tscope, - simulator_proto_unix_io, - blue_full_system_proto_unix_io, - yellow_full_system_proto_unix_io, - gamecontroller, - ) + runner = SimulatedTestRunner( + current_test, + tscope, + simulator_proto_unix_io, + blue_full_system_proto_unix_io, + yellow_full_system_proto_unix_io, + gamecontroller, + ) yield runner diff --git a/src/software/gameplay_tests/simulated_test_runner.py b/src/software/gameplay_tests/simulated_test_runner.py index 7577210347..84f2ad53c4 100644 --- a/src/software/gameplay_tests/simulated_test_runner.py +++ b/src/software/gameplay_tests/simulated_test_runner.py @@ -51,12 +51,76 @@ def __init__( self.simulator_proto_unix_io = simulator_proto_unix_io @override - def set_world_state(self, worldstate: WorldState): - """Sets the simulation worldstate + def set_world_state(self, world_state: WorldState): + """Sets the world state of the simulator. - :param worldstate: proto containing the desired worldstate + :param world_state: The WorldState proto to use """ - self.simulator_proto_unix_io.send_proto(WorldState, worldstate) + self.simulator_proto_unix_io.send_proto(WorldState, world_state) + + @override + def run_test( + self, + setup=(lambda: None), + always_validation_sequence_set=[[]], + eventually_validation_sequence_set=[[]], + test_timeout_s=3, + tick_duration_s=0.0166, # Default to 60hz + ci_cmd_with_delay=[], + run_till_end=True, + ): + """Helper function to run a test, with thunderscope if enabled + + :param always_validation_sequence_set: validation that should always be true + :param eventually_validation_sequence_set: validation that should eventually be true + :param test_timeout_s: how long the test should run before timing out + :param tick_duration_s: length of a tick + :param ci_cmd_with_delay: A list consisting of tuples with a duration and CI command, e.g. + [ + (time, command, team), + (time, command, team), + ... + ] + :param run_till_end: If true, test runs till the end even if eventually validation passes + If false, test stops once eventually validation passes and fails if time out + """ + + threading.excepthook = self.excepthook + self.sync_setup(setup) + + # If thunderscope is enabled, run the test in a thread and show + # thunderscope on this thread. The excepthook is setup to catch + # any test failures and propagate them to the main thread + if self.thunderscope: + run_sim_thread = threading.Thread( + target=self.runner, + daemon=True, + args=[ + always_validation_sequence_set, + eventually_validation_sequence_set, + test_timeout_s, + tick_duration_s, + ci_cmd_with_delay, + run_till_end, + ], + ) + run_sim_thread.start() + self.thunderscope.show() + run_sim_thread.join() + + if self.last_exception: + pytest.fail(str(self.last_exception)) + + # If thunderscope is disabled, just run the test + else: + self.runner( + always_validation_sequence_set, + eventually_validation_sequence_set, + test_timeout_s, + tick_duration_s, + ci_cmd_with_delay=ci_cmd_with_delay, + run_till_end=run_till_end, + ) def excepthook(self, args): """This function is _critical_ for show_thunderscope to work. @@ -80,7 +144,7 @@ def __stopper(self, delay=PROCESS_BUFFER_DELAY_S): if self.thunderscope: self.thunderscope.close() - def sync_setup(self, setup, param): + def sync_setup(self, setup): """Run setup until simulator has received game state :param setup: Function that sets up the world state @@ -92,7 +156,7 @@ def sync_setup(self, setup, param): ) while True: - setup(param) + setup() try: world_state_received_buffer.get( @@ -240,163 +304,3 @@ def runner( validation.check_validation(eventually_validation_proto_set) self.__stopper() - - @override - def run_test( - self, - always_validation_sequence_set, - eventually_validation_sequence_set, - test_timeout_s=3, - tick_duration_s=0.0166, # Default to 60hz - index=0, - ci_cmd_with_delay=[], - run_till_end=True, - **kwargs, - ): - """Helper function to run a test, with thunderscope if enabled - - :param always_validation_sequence_set: validation that should always be true - :param eventually_validation_sequence_set: validation that should eventually be true - :param test_timeout_s: how long the test should run before timing out - :param tick_duration_s: length of a tick - :param index: index of the current test. default is 0 (invariant test) - values can be passed in during aggregate testing for different timeout durations - :param ci_cmd_with_delay: A list consisting of tuples with a duration and CI command, e.g. - [ - (time, command, team), - (time, command, team), - ... - ] - :param run_till_end: If true, test runs till the end even if eventually validation passes - If false, test stops once eventually validation passes and fails if time out - """ - test_timeout_duration = ( - test_timeout_s[index] if type(test_timeout_s) == list else test_timeout_s - ) - - # If thunderscope is enabled, run the test in a thread and show - # thunderscope on this thread. The excepthook is setup to catch - # any test failures and propagate them to the main thread - if self.thunderscope: - run_sim_thread = threading.Thread( - target=self.runner, - daemon=True, - args=[ - always_validation_sequence_set, - eventually_validation_sequence_set, - test_timeout_duration, - tick_duration_s, - ci_cmd_with_delay, - run_till_end, - ], - ) - run_sim_thread.start() - self.thunderscope.show() - run_sim_thread.join() - - if self.last_exception: - pytest.fail(str(self.last_exception)) - - # If thunderscope is disabled, just run the test - else: - self.runner( - always_validation_sequence_set, - eventually_validation_sequence_set, - test_timeout_duration, - tick_duration_s, - ci_cmd_with_delay=ci_cmd_with_delay, - run_till_end=run_till_end, - ) - - -class InvariantTestRunner(SimulatedTestRunner): - """Runs a simulated test only once with a given parameter - - Test passes or fails based on the outcome of this test - """ - - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - - @override - def run_test( - self, - setup=(lambda x: None), - params=[0], - inv_always_validation_sequence_set=[[]], - inv_eventually_validation_sequence_set=[[]], - **kwargs, - ): - """Run an invariant test - - :param setup: Function that sets up the World state and the gamecontroller before running the test - :param params: List of parameters for each iteration of the test - (this method only uses the first element) - :param inv_always_validation_sequence_set: Validation functions for invariant testing - that should hold on every tick - :param inv_eventually_validation_sequence_set: Validation functions for invariant testing - that should eventually be true, before the test ends - """ - threading.excepthook = self.excepthook - - super().sync_setup(setup, params[0]) - - super().run_test( - inv_always_validation_sequence_set, - inv_eventually_validation_sequence_set, - **kwargs, - ) - - -class AggregateTestRunner(SimulatedTestRunner): - """Runs a simulated test multiple times with different given parameters - - Result of the test is determined by comparing the number of - passing iterations to a predetermined acceptable threshold - """ - - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - - @override - def run_test( - self, - setup=(lambda arg: None), - params=[], - ag_always_validation_sequence_set=[[]], - ag_eventually_validation_sequence_set=[[]], - **kwargs, - ): - """Run an aggregate test - - :param setup: Function that sets up the World state and the gamecontroller before running the test - :param params: List of parameters for each iteration of the test - :param ag_always_validation_sequence_set: Validation functions for aggregate testing - that should hold on every tick - :param ag_eventually_validation_sequence_set: Validation functions for aggregate testing - that should eventually be true, before the test end - """ - threading.excepthook = self.excepthook - - failed_tests = 0 - - # Runs the test once for each given parameter - # Catches Assertion Error thrown by failing test and increments counter - # Calculates overall results and prints them - for x in range(len(params)): - super().sync_setup(setup, params[x]) - - try: - super().run_test( - ag_always_validation_sequence_set, - ag_eventually_validation_sequence_set, - **kwargs, - ) - except AssertionError: - failed_tests += 1 - - # TODO (#2856) Fix validation and results output - - logger.info(f"{failed_tests} test failed") - - assert failed_tests == 0 diff --git a/src/software/gameplay_tests/tbots_test_runner.py b/src/software/gameplay_tests/tbots_test_runner.py index a24bf8c137..a4fadb6d90 100644 --- a/src/software/gameplay_tests/tbots_test_runner.py +++ b/src/software/gameplay_tests/tbots_test_runner.py @@ -135,10 +135,10 @@ def _create_assigned_tactic_params(self, tactics: dict[int, Any]): return params @abstractmethod - def set_world_state(self, worldstate: WorldState): - """Sets the worldstate for the given team + def set_world_state(self, world_state: WorldState): + """Sets the initial world state of the test. - :param worldstate: the worldstate proto to use + :param world_state: The WorldState proto to use """ raise NotImplementedError("abstract class method called set_world_state") diff --git a/src/software/gameplay_tests/util.py b/src/software/gameplay_tests/util.py index 7d7f984fac..4b8b0a4f2d 100644 --- a/src/software/gameplay_tests/util.py +++ b/src/software/gameplay_tests/util.py @@ -71,9 +71,6 @@ def load_command_line_arguments(allow_unrecognized: bool = False): ) simulated_group = parser.add_argument_group("Simulated test arguments") - simulated_group.add_argument( - "--aggregate", action="store_true", default=False, help="Run aggregate test" - ) simulated_group.add_argument( "--simulator_runtime_dir", type=str, From 8fb0214cc0b848d02cee8e35fdb0a76d628a5181 Mon Sep 17 00:00:00 2001 From: Eric Xiao Date: Sat, 30 May 2026 15:04:36 -0700 Subject: [PATCH 12/18] Get rid of params argument for sim tests --- .../ball_placement/ball_placement_play_test.py | 18 ++++-------------- .../hl/stp/play/defense/defense_play_test.py | 6 ------ .../enemy_ball_placement_play_test.py | 6 +----- .../enemy_free_kick_play_test.py | 3 --- .../ai/hl/stp/play/halt_play/halt_play_test.py | 5 ----- .../hl/stp/play/offense/offense_play_test.py | 10 ++-------- .../ai/hl/stp/play/passing_sim_test.py | 5 ++--- .../ai/hl/stp/tactic/move/move_tactic_test.py | 14 +++++--------- .../trajectory/simulated_hrvo_test.py | 7 ++----- 9 files changed, 16 insertions(+), 58 deletions(-) diff --git a/src/software/ai/hl/stp/play/ball_placement/ball_placement_play_test.py b/src/software/ai/hl/stp/play/ball_placement/ball_placement_play_test.py index f9d550e29c..780f178f64 100644 --- a/src/software/ai/hl/stp/play/ball_placement/ball_placement_play_test.py +++ b/src/software/ai/hl/stp/play/ball_placement/ball_placement_play_test.py @@ -185,31 +185,21 @@ def run_ball_placement_scenario( gameplay_test_runner.run_test( setup=lambda test_setup_arg: ball_placement_play_setup( - test_setup_arg["ball_start_point"], - test_setup_arg["ball_placement_point"], + ball_start_point, + ball_placement_point, gameplay_test_runner, blue_only, ), - params=[ - { - "ball_start_point": ball_start_point, - "ball_placement_point": ball_placement_point, - } - ], inv_always_validation_sequence_set=[[]], inv_eventually_validation_sequence_set=placement_eventually_validation_sequence_set, - ag_always_validation_sequence_set=[[]], - ag_eventually_validation_sequence_set=placement_eventually_validation_sequence_set, - test_timeout_s=[15], + test_timeout_s=15, ) gameplay_test_runner.run_test( # setup argument isn't passed to preserve world state from previous test run inv_always_validation_sequence_set=drop_ball_always_validation_sequence_set, inv_eventually_validation_sequence_set=drop_ball_eventually_validation_sequence_set, - ag_always_validation_sequence_set=drop_ball_always_validation_sequence_set, - ag_eventually_validation_sequence_set=drop_ball_eventually_validation_sequence_set, - test_timeout_s=[5], + test_timeout_s=5, ) diff --git a/src/software/ai/hl/stp/play/defense/defense_play_test.py b/src/software/ai/hl/stp/play/defense/defense_play_test.py index 03b0f1c560..00c8112a2f 100644 --- a/src/software/ai/hl/stp/play/defense/defense_play_test.py +++ b/src/software/ai/hl/stp/play/defense/defense_play_test.py @@ -61,7 +61,6 @@ def setup(*args): gameplay_test_runner.run_test( setup=setup, - params=[0, 1, 2, 3, 4], # The aggregate test runs 5 times inv_always_validation_sequence_set=[ [ BallNeverEntersRegion( @@ -72,8 +71,6 @@ def setup(*args): inv_eventually_validation_sequence_set=[ [FriendlyEventuallyHasBallPossession(tolerance=0.2)] ], - ag_always_validation_sequence_set=[[]], - ag_eventually_validation_sequence_set=[[]], test_timeout_s=20, ) @@ -126,7 +123,6 @@ def setup(*args): gameplay_test_runner.run_test( setup=setup, - params=[0, 1, 2, 3, 4], # The aggregate test runs 5 times inv_always_validation_sequence_set=[ [ BallNeverEntersRegion( @@ -137,8 +133,6 @@ def setup(*args): inv_eventually_validation_sequence_set=[ [FriendlyEventuallyHasBallPossession(tolerance=0.1)] ], - ag_always_validation_sequence_set=[[]], - ag_eventually_validation_sequence_set=[[]], test_timeout_s=30, ) diff --git a/src/software/ai/hl/stp/play/enemy_ball_placement/enemy_ball_placement_play_test.py b/src/software/ai/hl/stp/play/enemy_ball_placement/enemy_ball_placement_play_test.py index 07a69ec045..46f2a17009 100644 --- a/src/software/ai/hl/stp/play/enemy_ball_placement/enemy_ball_placement_play_test.py +++ b/src/software/ai/hl/stp/play/enemy_ball_placement/enemy_ball_placement_play_test.py @@ -74,11 +74,7 @@ def setup(*args): gameplay_test_runner.run_test( setup=setup, - params=[0], - inv_always_validation_sequence_set=always_validation_sequence_set, - inv_eventually_validation_sequence_set=[[]], - ag_always_validation_sequence_set=always_validation_sequence_set, - ag_eventually_validation_sequence_set=[[]], + always_validation_sequence_set=always_validation_sequence_set, test_timeout_s=15, ) diff --git a/src/software/ai/hl/stp/play/enemy_free_kick/enemy_free_kick_play_test.py b/src/software/ai/hl/stp/play/enemy_free_kick/enemy_free_kick_play_test.py index e92205ad98..0821e9d88c 100644 --- a/src/software/ai/hl/stp/play/enemy_free_kick/enemy_free_kick_play_test.py +++ b/src/software/ai/hl/stp/play/enemy_free_kick/enemy_free_kick_play_test.py @@ -143,11 +143,8 @@ def setup(*args): gameplay_test_runner.run_test( setup=setup, - params=[0, 1, 2], inv_eventually_validation_sequence_set=eventually_validation_sequence_set, inv_always_validation_sequence_set=always_validation_sequence_set, - ag_eventually_validation_sequence_set=eventually_validation_sequence_set, - ag_always_validation_sequence_set=always_validation_sequence_set, test_timeout_s=8, ) diff --git a/src/software/ai/hl/stp/play/halt_play/halt_play_test.py b/src/software/ai/hl/stp/play/halt_play/halt_play_test.py index c918948362..1a7ba6182f 100644 --- a/src/software/ai/hl/stp/play/halt_play/halt_play_test.py +++ b/src/software/ai/hl/stp/play/halt_play/halt_play_test.py @@ -54,15 +54,10 @@ def setup(*args): # params just have to be a list of length 1 to ensure the test runs at least once gameplay_test_runner.run_test( setup=setup, - params=[0], inv_always_validation_sequence_set=[[]], inv_eventually_validation_sequence_set=[ [RobotSpeedEventuallyBelowThreshold(1e-3)] ], - ag_always_validation_sequence_set=[[]], - ag_eventually_validation_sequence_set=[ - [RobotSpeedEventuallyBelowThreshold(1e-3)] - ], ci_cmd_with_delay=[ (3, Command.Type.HALT, Team.BLUE), (3, Command.Type.HALT, Team.YELLOW), diff --git a/src/software/ai/hl/stp/play/offense/offense_play_test.py b/src/software/ai/hl/stp/play/offense/offense_play_test.py index 715afe0f3f..623fd92d45 100644 --- a/src/software/ai/hl/stp/play/offense/offense_play_test.py +++ b/src/software/ai/hl/stp/play/offense/offense_play_test.py @@ -12,8 +12,8 @@ def test_offense_play(gameplay_test_runner): - def setup(start_point): - ball_initial_pos = start_point + def setup(*args): + ball_initial_pos = tbots_cpp.Point(-4.4, 2.9) blue_bots = [ tbots_cpp.Point(-4.5, 3.0), @@ -65,19 +65,13 @@ def setup(start_point): [NeverExcessivelyDribbles()], ] - ag_always_validation_sequence_set = [[FriendlyAlwaysHasBallPossession()]] - # Eventually Validation inv_eventually_validation_sequence_set = [[]] - ag_eventually_validation_sequence_set = [[FriendlyTeamEventuallyScored()]] gameplay_test_runner.run_test( - params=[tbots_cpp.Point(-4.4, 2.9)], setup=setup, inv_eventually_validation_sequence_set=inv_eventually_validation_sequence_set, inv_always_validation_sequence_set=inv_always_validation_sequence_set, - ag_eventually_validation_sequence_set=ag_eventually_validation_sequence_set, - ag_always_validation_sequence_set=ag_always_validation_sequence_set, test_timeout_s=15, run_till_end=True, ) diff --git a/src/software/ai/hl/stp/play/passing_sim_test.py b/src/software/ai/hl/stp/play/passing_sim_test.py index 6f7fc6dfda..bd6bf91847 100644 --- a/src/software/ai/hl/stp/play/passing_sim_test.py +++ b/src/software/ai/hl/stp/play/passing_sim_test.py @@ -256,9 +256,8 @@ def test_passing_receive_speed( gameplay_test_runner=gameplay_test_runner, receive_pass=True, ), - params=[0], - inv_eventually_validation_sequence_set=eventually_validation_sequence_set, - inv_always_validation_sequence_set=always_validation_sequence_set, + eventually_validation_sequence_set=eventually_validation_sequence_set, + always_validation_sequence_set=always_validation_sequence_set, test_timeout_s=10, run_till_end=False, ) diff --git a/src/software/ai/hl/stp/tactic/move/move_tactic_test.py b/src/software/ai/hl/stp/tactic/move/move_tactic_test.py index de2aacca44..e6204347fa 100644 --- a/src/software/ai/hl/stp/tactic/move/move_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/move/move_tactic_test.py @@ -75,8 +75,7 @@ def setup(*args): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validation_sequence_set, - ag_eventually_validation_sequence_set=eventually_validation_sequence_set, + eventually_validation_sequence_set=eventually_validation_sequence_set, test_timeout_s=5, ) @@ -137,8 +136,7 @@ def setup(*args): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validation_sequence_set, - ag_eventually_validation_sequence_set=eventually_validation_sequence_set, + eventually_validation_sequence_set=eventually_validation_sequence_set, test_timeout_s=10, ) @@ -196,8 +194,7 @@ def setup(*args): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validation_sequence_set, - ag_eventually_validation_sequence_set=eventually_validation_sequence_set, + eventually_validation_sequence_set=eventually_validation_sequence_set, test_timeout_s=5, ) @@ -252,7 +249,7 @@ def setup(*args): def test_spinning_move( orientation, initial_position, destination, angular_velocity, gameplay_test_runner ): - def setup(*args): + def setup(): gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[initial_position], @@ -296,8 +293,7 @@ def setup(*args): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validation_sequence_set, - ag_eventually_validation_sequence_set=eventually_validation_sequence_set, + eventually_validation_sequence_set=eventually_validation_sequence_set, test_timeout_s=5, ) diff --git a/src/software/ai/navigator/trajectory/simulated_hrvo_test.py b/src/software/ai/navigator/trajectory/simulated_hrvo_test.py index 7057c0456f..eeb7b61d67 100644 --- a/src/software/ai/navigator/trajectory/simulated_hrvo_test.py +++ b/src/software/ai/navigator/trajectory/simulated_hrvo_test.py @@ -499,11 +499,8 @@ def test_robot_movement( enemy_robots_destinations, gameplay_test_runner, ), - params=[0], - inv_eventually_validation_sequence_set=eventually_validation_sequence_set, - inv_always_validation_sequence_set=always_validation_sequence_set, - ag_eventually_validation_sequence_set=[[]], - ag_always_validation_sequence_set=[[]], + eventually_validation_sequence_set=eventually_validation_sequence_set, + always_validation_sequence_set=always_validation_sequence_set, test_timeout_s=timeout_s, run_till_end=run_till_end, ) From a5e6c07c41a4ab996409506663b8db45729b03f6 Mon Sep 17 00:00:00 2001 From: Eric Xiao Date: Sat, 30 May 2026 15:13:09 -0700 Subject: [PATCH 13/18] Rewrite signature of test setup functions --- .../play/crease_defense/crease_defense_play_test.py | 2 +- .../ai/hl/stp/play/defense/defense_play_test.py | 4 ++-- .../enemy_ball_placement_play_test.py | 2 +- .../play/enemy_free_kick/enemy_free_kick_play_test.py | 2 +- .../ai/hl/stp/play/example/example_play_test.py | 2 +- .../ai/hl/stp/play/free_kick/free_kick_play_test.py | 2 +- .../ai/hl/stp/play/halt_play/halt_play_test.py | 2 +- .../stp/play/kickoff_enemy/kickoff_enemy_play_test.py | 2 +- .../kickoff_friendly/kickoff_friendly_play_test.py | 2 +- src/software/ai/hl/stp/play/kickoff_play_test.py | 2 +- .../ai/hl/stp/play/offense/offense_play_test.py | 2 +- .../penalty_kick_enemy/penalty_kick_enemy_play_test.py | 2 +- .../stp/play/shoot_or_chip/shoot_or_chip_play_test.py | 2 +- .../stp/play/shoot_or_pass/shoot_or_pass_play_test.py | 2 +- src/software/ai/hl/stp/play/stop_play_test.py | 2 +- .../ai/hl/stp/tactic/attacker/attacker_tactic_test.py | 6 +++--- src/software/ai/hl/stp/tactic/chip/chip_tactic_test.py | 2 +- .../crease_defender/crease_defender_tactic_test.py | 10 +++++----- .../ai/hl/stp/tactic/dribble/dribble_tactic_test.py | 10 +++++----- .../ai/hl/stp/tactic/goalie/goalie_tactic_test.py | 4 ++-- src/software/ai/hl/stp/tactic/halt/halt_tactic_test.py | 2 +- src/software/ai/hl/stp/tactic/kick/kick_tactic_test.py | 2 +- src/software/ai/hl/stp/tactic/move/move_tactic_test.py | 6 +++--- .../tactic/pass_defender/pass_defender_tactic_test.py | 6 +++--- .../tactic/penalty_kick/penalty_kick_tactic_test.py | 2 +- .../hl/stp/tactic/pivot_kick/pivot_kick_tactic_test.py | 2 +- .../ai/hl/stp/tactic/receiver/receiver_tactic_test.py | 2 +- .../sensor_fusion/filter/ball_occlusion_test.py | 2 +- 28 files changed, 44 insertions(+), 44 deletions(-) diff --git a/src/software/ai/hl/stp/play/crease_defense/crease_defense_play_test.py b/src/software/ai/hl/stp/play/crease_defense/crease_defense_play_test.py index 882fe5caa0..0197307beb 100644 --- a/src/software/ai/hl/stp/play/crease_defense/crease_defense_play_test.py +++ b/src/software/ai/hl/stp/play/crease_defense/crease_defense_play_test.py @@ -19,7 +19,7 @@ def test_crease_defense_play(gameplay_test_runner): field = tbots_cpp.Field.createSSLDivisionBField() goalie_position = tbots_cpp.Point(-4.5, 0) - def setup(*args): + def setup(): gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[ diff --git a/src/software/ai/hl/stp/play/defense/defense_play_test.py b/src/software/ai/hl/stp/play/defense/defense_play_test.py index 00c8112a2f..1adee8f06f 100644 --- a/src/software/ai/hl/stp/play/defense/defense_play_test.py +++ b/src/software/ai/hl/stp/play/defense/defense_play_test.py @@ -36,7 +36,7 @@ ], ) def test_defense_play_ball_steal(gameplay_test_runner, blue_bots, yellow_bots): - def setup(*args): + def setup(): ball_initial_pos = tbots_cpp.Point(0.93, 0) gameplay_test_runner.set_world_state( @@ -98,7 +98,7 @@ def setup(*args): ], ) def test_defense_play(gameplay_test_runner, blue_bots, yellow_bots): - def setup(*args): + def setup(): ball_initial_pos = tbots_cpp.Point(0.9, 2.85) gameplay_test_runner.set_world_state( diff --git a/src/software/ai/hl/stp/play/enemy_ball_placement/enemy_ball_placement_play_test.py b/src/software/ai/hl/stp/play/enemy_ball_placement/enemy_ball_placement_play_test.py index 46f2a17009..b2cf5585f9 100644 --- a/src/software/ai/hl/stp/play/enemy_ball_placement/enemy_ball_placement_play_test.py +++ b/src/software/ai/hl/stp/play/enemy_ball_placement/enemy_ball_placement_play_test.py @@ -22,7 +22,7 @@ def test_two_ai_ball_placement( gameplay_test_runner, ball_start_point, ball_placement_point ): - def setup(*args): + def setup(): blue_bots = [ tbots_cpp.Point(-4.5, 0), tbots_cpp.Point(-4, 0.5), diff --git a/src/software/ai/hl/stp/play/enemy_free_kick/enemy_free_kick_play_test.py b/src/software/ai/hl/stp/play/enemy_free_kick/enemy_free_kick_play_test.py index 0821e9d88c..3eda2ffba2 100644 --- a/src/software/ai/hl/stp/play/enemy_free_kick/enemy_free_kick_play_test.py +++ b/src/software/ai/hl/stp/play/enemy_free_kick/enemy_free_kick_play_test.py @@ -99,7 +99,7 @@ def test_enemy_free_kick_play( gameplay_test_runner, blue_bots, yellow_bots, ball_initial_pos ): - def setup(*args): + def setup(): gameplay_test_runner.set_world_state( create_world_state( yellow_robot_locations=yellow_bots, diff --git a/src/software/ai/hl/stp/play/example/example_play_test.py b/src/software/ai/hl/stp/play/example/example_play_test.py index d933e6a009..12ddba899f 100644 --- a/src/software/ai/hl/stp/play/example/example_play_test.py +++ b/src/software/ai/hl/stp/play/example/example_play_test.py @@ -15,7 +15,7 @@ def test_example_play(gameplay_test_runner): ball_initial_pos = tbots_cpp.Point(0, 0) - def setup(*args): + def setup(): blue_bots = [ tbots_cpp.Point(-3, 2.5), tbots_cpp.Point(-3, 1.5), diff --git a/src/software/ai/hl/stp/play/free_kick/free_kick_play_test.py b/src/software/ai/hl/stp/play/free_kick/free_kick_play_test.py index 2869f38823..6e4c5a296b 100644 --- a/src/software/ai/hl/stp/play/free_kick/free_kick_play_test.py +++ b/src/software/ai/hl/stp/play/free_kick/free_kick_play_test.py @@ -32,7 +32,7 @@ ], ) def test_free_kick_play_friendly(ball_initial_pos, must_score, gameplay_test_runner): - def setup(*args): + def setup(): blue_bots = [ tbots_cpp.Point(-4.5, 0), tbots_cpp.Point(-3, 1.5), diff --git a/src/software/ai/hl/stp/play/halt_play/halt_play_test.py b/src/software/ai/hl/stp/play/halt_play/halt_play_test.py index 1a7ba6182f..4e0716427d 100644 --- a/src/software/ai/hl/stp/play/halt_play/halt_play_test.py +++ b/src/software/ai/hl/stp/play/halt_play/halt_play_test.py @@ -10,7 +10,7 @@ # TODO issue #2599 - Remove Duration parameter from test # @pytest.mark.parametrize("run_enemy_ai,test_duration", [(False, 20), (True, 20)]) def test_halt_play(gameplay_test_runner): - def setup(*args): + def setup(): ball_initial_pos = tbots_cpp.Point(0, 0) blue_bots = [ diff --git a/src/software/ai/hl/stp/play/kickoff_enemy/kickoff_enemy_play_test.py b/src/software/ai/hl/stp/play/kickoff_enemy/kickoff_enemy_play_test.py index be14bf2df5..e6a221f2ee 100644 --- a/src/software/ai/hl/stp/play/kickoff_enemy/kickoff_enemy_play_test.py +++ b/src/software/ai/hl/stp/play/kickoff_enemy/kickoff_enemy_play_test.py @@ -22,7 +22,7 @@ def test_kickoff_enemy_play(gameplay_test_runner): ball_initial_pos = tbots_cpp.Point(0, 0) field = tbots_cpp.Field.createSSLDivisionBField() - def setup(*args): + def setup(): blue_bots = [ tbots_cpp.Point(-3, 2.5), tbots_cpp.Point(-2.8, 2.5), diff --git a/src/software/ai/hl/stp/play/kickoff_friendly/kickoff_friendly_play_test.py b/src/software/ai/hl/stp/play/kickoff_friendly/kickoff_friendly_play_test.py index 236bd6f692..be926e7353 100644 --- a/src/software/ai/hl/stp/play/kickoff_friendly/kickoff_friendly_play_test.py +++ b/src/software/ai/hl/stp/play/kickoff_friendly/kickoff_friendly_play_test.py @@ -25,7 +25,7 @@ def test_kickoff_friendly_play(gameplay_test_runner): ball_initial_pos = tbots_cpp.Point(0, 0) - def setup(*args): + def setup(): field = tbots_cpp.Field.createSSLDivisionBField() blue_bots = [ diff --git a/src/software/ai/hl/stp/play/kickoff_play_test.py b/src/software/ai/hl/stp/play/kickoff_play_test.py index 3381a835d1..165f0ea70d 100644 --- a/src/software/ai/hl/stp/play/kickoff_play_test.py +++ b/src/software/ai/hl/stp/play/kickoff_play_test.py @@ -17,7 +17,7 @@ def test_kickoff_play(gameplay_test_runner, is_friendly_test): ball_initial_pos = tbots_cpp.Point(0, 0) - def setup(*args): + def setup(): blue_bots = [ tbots_cpp.Point(-3, 2.5), tbots_cpp.Point(-3, 1.5), diff --git a/src/software/ai/hl/stp/play/offense/offense_play_test.py b/src/software/ai/hl/stp/play/offense/offense_play_test.py index 623fd92d45..5deb7427d1 100644 --- a/src/software/ai/hl/stp/play/offense/offense_play_test.py +++ b/src/software/ai/hl/stp/play/offense/offense_play_test.py @@ -12,7 +12,7 @@ def test_offense_play(gameplay_test_runner): - def setup(*args): + def setup(): ball_initial_pos = tbots_cpp.Point(-4.4, 2.9) blue_bots = [ diff --git a/src/software/ai/hl/stp/play/penalty_kick_enemy/penalty_kick_enemy_play_test.py b/src/software/ai/hl/stp/play/penalty_kick_enemy/penalty_kick_enemy_play_test.py index 42756634e3..0ccc8a48a7 100644 --- a/src/software/ai/hl/stp/play/penalty_kick_enemy/penalty_kick_enemy_play_test.py +++ b/src/software/ai/hl/stp/play/penalty_kick_enemy/penalty_kick_enemy_play_test.py @@ -103,7 +103,7 @@ def test_penalty_kick_enemy_play_setup( ball_initial_pos = field.enemyPenaltyMark() enemy_penalty_x = ball_initial_pos.x() - def setup(*args): + def setup(): # Enemy robots behind the penalty mark yellow_bots = [ tbots_cpp.Point(enemy_penalty_x + 0.3, 0), # kicker robot diff --git a/src/software/ai/hl/stp/play/shoot_or_chip/shoot_or_chip_play_test.py b/src/software/ai/hl/stp/play/shoot_or_chip/shoot_or_chip_play_test.py index 322a6fe154..c8834480c6 100644 --- a/src/software/ai/hl/stp/play/shoot_or_chip/shoot_or_chip_play_test.py +++ b/src/software/ai/hl/stp/play/shoot_or_chip/shoot_or_chip_play_test.py @@ -13,7 +13,7 @@ def test_shoot_or_chip_play(gameplay_test_runner): - def setup(*args): + def setup(): ball_initial_pos = tbots_cpp.Point(-1.4, 2) ball_initial_vel = tbots_cpp.Vector(0, 0) diff --git a/src/software/ai/hl/stp/play/shoot_or_pass/shoot_or_pass_play_test.py b/src/software/ai/hl/stp/play/shoot_or_pass/shoot_or_pass_play_test.py index a6dce57a7b..d7e82eb22b 100644 --- a/src/software/ai/hl/stp/play/shoot_or_pass/shoot_or_pass_play_test.py +++ b/src/software/ai/hl/stp/play/shoot_or_pass/shoot_or_pass_play_test.py @@ -17,7 +17,7 @@ def test_shoot_or_pass_play(gameplay_test_runner): field = tbots_cpp.Field.createSSLDivisionBField() - def setup(*args): + def setup(): gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[ diff --git a/src/software/ai/hl/stp/play/stop_play_test.py b/src/software/ai/hl/stp/play/stop_play_test.py index 3144655f2d..a5daeb470b 100644 --- a/src/software/ai/hl/stp/play/stop_play_test.py +++ b/src/software/ai/hl/stp/play/stop_play_test.py @@ -120,7 +120,7 @@ def test_stop_play(ball_position, blue_robot_positions, gameplay_test_runner): field = tbots_cpp.Field.createSSLDivisionBField() - def setup(*args): + def setup(): gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=blue_robot_positions, diff --git a/src/software/ai/hl/stp/tactic/attacker/attacker_tactic_test.py b/src/software/ai/hl/stp/tactic/attacker/attacker_tactic_test.py index d3340482f4..faaca151b1 100644 --- a/src/software/ai/hl/stp/tactic/attacker/attacker_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/attacker/attacker_tactic_test.py @@ -121,7 +121,7 @@ def test_attacker_passing( ball_velocity, gameplay_test_runner, ): - def setup(*args): + def setup(): gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[ @@ -231,7 +231,7 @@ def test_attacker_keep_away( field_top_left = field.fieldLines().negXPosYCorner() # Keep away near field corner (second test case from C++) - def setup(*args): + def setup(): robot_pos = field_top_left ball_pos = tbots_cpp.Point(field_top_left.x() + 0.05, field_top_left.y() - 0.2) enemy_positions = [ @@ -352,7 +352,7 @@ def test_attacker_shoot_goal( ): field = tbots_cpp.Field.createSSLDivisionBField() - def setup(*args): + def setup(): gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[robot_pos], diff --git a/src/software/ai/hl/stp/tactic/chip/chip_tactic_test.py b/src/software/ai/hl/stp/tactic/chip/chip_tactic_test.py index cc03adfd4e..ece6de9595 100644 --- a/src/software/ai/hl/stp/tactic/chip/chip_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/chip/chip_tactic_test.py @@ -52,7 +52,7 @@ def test_chip(ball_offset_from_robot, angle_to_chip_at, gameplay_test_runner): robot_position = tbots_cpp.Point(0, 0) ball_position = robot_position + ball_offset_from_robot - def setup(*args): + def setup(): gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[ diff --git a/src/software/ai/hl/stp/tactic/crease_defender/crease_defender_tactic_test.py b/src/software/ai/hl/stp/tactic/crease_defender/crease_defender_tactic_test.py index 68c78c8a54..ee84ebac77 100644 --- a/src/software/ai/hl/stp/tactic/crease_defender/crease_defender_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/crease_defender/crease_defender_tactic_test.py @@ -31,7 +31,7 @@ def test_not_bumping_ball_towards_net(gameplay_test_runner): enemy_threat_point = tbots_cpp.Point(3, 0) - def setup(*args): + def setup(): gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[tbots_cpp.Point(0, 0)], @@ -83,7 +83,7 @@ def test_crease_region_positioning( ): field = tbots_cpp.Field.createSSLDivisionBField() - def setup(*args): + def setup(): gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[tbots_cpp.Point(-3, 1.5)], @@ -213,7 +213,7 @@ def test_crease_positioning( ball_initial_velocity, gameplay_test_runner, ): - def setup(*args): + def setup(): gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[blue_bots], @@ -323,7 +323,7 @@ def test_crease_autochip( should_chip, gameplay_test_runner, ): - def setup(*args): + def setup(): gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[blue_bots], @@ -395,7 +395,7 @@ def test_crease_get_ball( should_dribble, gameplay_test_runner, ): - def setup(*args): + def setup(): gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[blue_bots], diff --git a/src/software/ai/hl/stp/tactic/dribble/dribble_tactic_test.py b/src/software/ai/hl/stp/tactic/dribble/dribble_tactic_test.py index df27e73193..42be5109f9 100644 --- a/src/software/ai/hl/stp/tactic/dribble/dribble_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/dribble/dribble_tactic_test.py @@ -131,7 +131,7 @@ def test_dribble( ball_vel, gameplay_test_runner, ): - def setup(*args): + def setup(): gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[ @@ -299,7 +299,7 @@ def test_excessive_dribbling_without_enemies( gameplay_test_runner, blue_robot_location, ): - def setup(*args): + def setup(): gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[blue_robot_location], @@ -344,7 +344,7 @@ def test_dribble_with_excessive_dribbling(gameplay_test_runner): initial_position = tbots_cpp.Point(4.5, -3.0) dribble_orientation = tbots_cpp.Angle.half() - def setup(*args): + def setup(): gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[ @@ -395,7 +395,7 @@ def test_run_into_enemy_robot_knock_ball_away( ball_pos = tbots_cpp.Point(2, -2) ball_vel = tbots_cpp.Vector(2, 4) - def setup(*args): + def setup(): gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[ @@ -445,7 +445,7 @@ def test_robot_not_bumping_ball_when_turning( robot_location = tbots_cpp.Point(-1, 0) ball_location = robot_location + tbots_cpp.Vector(ROBOT_MAX_RADIUS_METERS, 0) - def setup(*args): + def setup(): gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[tbots_cpp.Point(-3, 2.5), robot_location], diff --git a/src/software/ai/hl/stp/tactic/goalie/goalie_tactic_test.py b/src/software/ai/hl/stp/tactic/goalie/goalie_tactic_test.py index 4633122fb0..baa8787014 100644 --- a/src/software/ai/hl/stp/tactic/goalie/goalie_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/goalie/goalie_tactic_test.py @@ -114,7 +114,7 @@ def test_goalie_blocks_shot( robot_initial_position, gameplay_test_runner, ): - def setup(*args): + def setup(): gameplay_test_runner.set_world_state( create_world_state( [], @@ -191,7 +191,7 @@ def test_goalie_clears_from_dead_zone( should_clear, gameplay_test_runner, ): - def setup(*args): + def setup(): gameplay_test_runner.set_world_state( create_world_state( [], diff --git a/src/software/ai/hl/stp/tactic/halt/halt_tactic_test.py b/src/software/ai/hl/stp/tactic/halt/halt_tactic_test.py index 9217b725f3..db4987d125 100644 --- a/src/software/ai/hl/stp/tactic/halt/halt_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/halt/halt_tactic_test.py @@ -32,7 +32,7 @@ ], ) def test_robot_halt(blue_robot_locations, blue_robot_velocities, gameplay_test_runner): - def setup(*args): + def setup(): gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=blue_robot_locations, diff --git a/src/software/ai/hl/stp/tactic/kick/kick_tactic_test.py b/src/software/ai/hl/stp/tactic/kick/kick_tactic_test.py index 3c9cdebbfa..1dc8c764ad 100644 --- a/src/software/ai/hl/stp/tactic/kick/kick_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/kick/kick_tactic_test.py @@ -42,7 +42,7 @@ def test_kick(ball_offset_from_robot, angle_to_kick_at, gameplay_test_runner): robot_position = tbots_cpp.Point(0, 0) ball_position = robot_position + ball_offset_from_robot - def setup(*args): + def setup(): gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[ diff --git a/src/software/ai/hl/stp/tactic/move/move_tactic_test.py b/src/software/ai/hl/stp/tactic/move/move_tactic_test.py index e6204347fa..528ca68a79 100644 --- a/src/software/ai/hl/stp/tactic/move/move_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/move/move_tactic_test.py @@ -33,7 +33,7 @@ def test_move_across_field(gameplay_test_runner): destination = tbots_cpp.Point(2.5, -1.1) field = tbots_cpp.Field.createSSLDivisionBField() - def setup(*args): + def setup(): gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[ @@ -85,7 +85,7 @@ def test_autochip_move(gameplay_test_runner): destination = tbots_cpp.Point(0, 1.5) field = tbots_cpp.Field.createSSLDivisionBField() - def setup(*args): + def setup(): gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[ @@ -146,7 +146,7 @@ def test_autokick_move(gameplay_test_runner): destination = tbots_cpp.Point(-1, -1) field = tbots_cpp.Field.createSSLDivisionBField() - def setup(*args): + def setup(): gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[initial_position], diff --git a/src/software/ai/hl/stp/tactic/pass_defender/pass_defender_tactic_test.py b/src/software/ai/hl/stp/tactic/pass_defender/pass_defender_tactic_test.py index 7e2191a3bc..bf98a56272 100644 --- a/src/software/ai/hl/stp/tactic/pass_defender/pass_defender_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/pass_defender/pass_defender_tactic_test.py @@ -36,7 +36,7 @@ def test_ball_chipped_on_intercept( position_to_block_from, gameplay_test_runner, ): - def setup(*args): + def setup(): gameplay_test_runner.set_world_state( create_world_state( [], @@ -109,7 +109,7 @@ def test_avoid_intercept_scenario( position_to_block_from, gameplay_test_runner, ): - def setup(*args): + def setup(): gameplay_test_runner.set_world_state( create_world_state( [], @@ -242,7 +242,7 @@ def test_steal_ball( should_steal, gameplay_test_runner, ): - def setup(*args): + def setup(): gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[position_to_block_from], diff --git a/src/software/ai/hl/stp/tactic/penalty_kick/penalty_kick_tactic_test.py b/src/software/ai/hl/stp/tactic/penalty_kick/penalty_kick_tactic_test.py index c319103343..883816315c 100644 --- a/src/software/ai/hl/stp/tactic/penalty_kick/penalty_kick_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/penalty_kick/penalty_kick_tactic_test.py @@ -55,7 +55,7 @@ def test_penalty_kick(enemy_robot_location, enemy_robot_velocity, gameplay_test_ field = tbots_cpp.Field.createSSLDivisionBField() ball_initial_pos = field.friendlyPenaltyMark() - def setup(*args): + def setup(): shooter_position = ball_initial_pos - tbots_cpp.Vector(0.1, 0) gameplay_test_runner.set_world_state( diff --git a/src/software/ai/hl/stp/tactic/pivot_kick/pivot_kick_tactic_test.py b/src/software/ai/hl/stp/tactic/pivot_kick/pivot_kick_tactic_test.py index fa543d4346..61ae9b2ba1 100644 --- a/src/software/ai/hl/stp/tactic/pivot_kick/pivot_kick_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/pivot_kick/pivot_kick_tactic_test.py @@ -40,7 +40,7 @@ def test_pivot_kick(ball_offset_from_robot, angle_to_kick_at, gameplay_test_runn robot_position = tbots_cpp.Point(0, 0) ball_position = robot_position + ball_offset_from_robot - def setup(*args): + def setup(): gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=[ diff --git a/src/software/ai/hl/stp/tactic/receiver/receiver_tactic_test.py b/src/software/ai/hl/stp/tactic/receiver/receiver_tactic_test.py index 3bd745b2e0..4aec176bef 100644 --- a/src/software/ai/hl/stp/tactic/receiver/receiver_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/receiver/receiver_tactic_test.py @@ -189,7 +189,7 @@ def test_receiver( one_touch, gameplay_test_runner, ): - def setup(*args): + def setup(): ball_velocity = calculate_ball_velocity( passer_point, receiver_point, pass_speed ) diff --git a/src/software/sensor_fusion/filter/ball_occlusion_test.py b/src/software/sensor_fusion/filter/ball_occlusion_test.py index 8a215a421f..1da5971d27 100644 --- a/src/software/sensor_fusion/filter/ball_occlusion_test.py +++ b/src/software/sensor_fusion/filter/ball_occlusion_test.py @@ -173,7 +173,7 @@ def test_ball_occlusion( yellow_robot_positions, gameplay_test_runner, ): - def setup(*args): + def setup(): gameplay_test_runner.set_world_state( create_world_state( blue_robot_locations=blue_robot_positions, From 43af45c11d82ce1db8a1f20056ed12dddf001786 Mon Sep 17 00:00:00 2001 From: Eric Xiao Date: Sat, 30 May 2026 15:19:32 -0700 Subject: [PATCH 14/18] Fix parameter names of calls to gameplay_test_runner.run_test() --- .../ball_placement_play_test.py | 9 ++++--- .../crease_defense_play_test.py | 3 +-- .../hl/stp/play/defense/defense_play_test.py | 8 +++---- .../enemy_free_kick_play_test.py | 4 ++-- .../hl/stp/play/example/example_play_test.py | 3 +-- .../stp/play/free_kick/free_kick_play_test.py | 3 +-- .../hl/stp/play/halt_play/halt_play_test.py | 6 +---- .../kickoff_enemy/kickoff_enemy_play_test.py | 6 ++--- .../kickoff_friendly_play_test.py | 6 ++--- .../ai/hl/stp/play/kickoff_play_test.py | 4 ++-- .../hl/stp/play/offense/offense_play_test.py | 8 ++----- .../ai/hl/stp/play/passing_sim_test.py | 6 ++--- .../penalty_kick_enemy_play_test.py | 3 +-- .../shoot_or_chip/shoot_or_chip_play_test.py | 2 -- .../shoot_or_pass/shoot_or_pass_play_test.py | 3 +-- src/software/ai/hl/stp/play/stop_play_test.py | 3 +-- .../tactic/attacker/attacker_tactic_test.py | 9 +++---- .../ai/hl/stp/tactic/chip/chip_tactic_test.py | 3 +-- .../crease_defender_tactic_test.py | 24 +++++++------------ .../stp/tactic/dribble/dribble_tactic_test.py | 21 ++++++---------- .../stp/tactic/goalie/goalie_tactic_test.py | 12 ++++------ .../ai/hl/stp/tactic/halt/halt_tactic_test.py | 3 +-- .../ai/hl/stp/tactic/kick/kick_tactic_test.py | 3 +-- .../pass_defender_tactic_test.py | 18 +++++--------- .../penalty_kick/penalty_kick_tactic_test.py | 4 ++-- .../pivot_kick/pivot_kick_tactic_test.py | 5 +--- .../tactic/receiver/receiver_tactic_test.py | 3 +-- .../trajectory/simulated_hrvo_test.py | 2 +- 28 files changed, 64 insertions(+), 120 deletions(-) diff --git a/src/software/ai/hl/stp/play/ball_placement/ball_placement_play_test.py b/src/software/ai/hl/stp/play/ball_placement/ball_placement_play_test.py index 780f178f64..100a22e459 100644 --- a/src/software/ai/hl/stp/play/ball_placement/ball_placement_play_test.py +++ b/src/software/ai/hl/stp/play/ball_placement/ball_placement_play_test.py @@ -184,21 +184,20 @@ def run_ball_placement_scenario( ] gameplay_test_runner.run_test( - setup=lambda test_setup_arg: ball_placement_play_setup( + setup=lambda: ball_placement_play_setup( ball_start_point, ball_placement_point, gameplay_test_runner, blue_only, ), - inv_always_validation_sequence_set=[[]], - inv_eventually_validation_sequence_set=placement_eventually_validation_sequence_set, + eventually_validation_sequence_set=placement_eventually_validation_sequence_set, test_timeout_s=15, ) gameplay_test_runner.run_test( # setup argument isn't passed to preserve world state from previous test run - inv_always_validation_sequence_set=drop_ball_always_validation_sequence_set, - inv_eventually_validation_sequence_set=drop_ball_eventually_validation_sequence_set, + always_validation_sequence_set=drop_ball_always_validation_sequence_set, + eventually_validation_sequence_set=drop_ball_eventually_validation_sequence_set, test_timeout_s=5, ) diff --git a/src/software/ai/hl/stp/play/crease_defense/crease_defense_play_test.py b/src/software/ai/hl/stp/play/crease_defense/crease_defense_play_test.py index 0197307beb..ed805f5c07 100644 --- a/src/software/ai/hl/stp/play/crease_defense/crease_defense_play_test.py +++ b/src/software/ai/hl/stp/play/crease_defense/crease_defense_play_test.py @@ -72,8 +72,7 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validations, - ag_eventually_validation_sequence_set=eventually_validations, + eventually_validation_sequence_set=eventually_validations, test_timeout_s=10, ) diff --git a/src/software/ai/hl/stp/play/defense/defense_play_test.py b/src/software/ai/hl/stp/play/defense/defense_play_test.py index 1adee8f06f..5af0e21a86 100644 --- a/src/software/ai/hl/stp/play/defense/defense_play_test.py +++ b/src/software/ai/hl/stp/play/defense/defense_play_test.py @@ -61,14 +61,14 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_always_validation_sequence_set=[ + always_validation_sequence_set=[ [ BallNeverEntersRegion( regions=[tbots_cpp.Field.createSSLDivisionBField().friendlyGoal()] ) ] ], - inv_eventually_validation_sequence_set=[ + eventually_validation_sequence_set=[ [FriendlyEventuallyHasBallPossession(tolerance=0.2)] ], test_timeout_s=20, @@ -123,14 +123,14 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_always_validation_sequence_set=[ + always_validation_sequence_set=[ [ BallNeverEntersRegion( regions=[tbots_cpp.Field.createSSLDivisionBField().friendlyGoal()] ) ] ], - inv_eventually_validation_sequence_set=[ + eventually_validation_sequence_set=[ [FriendlyEventuallyHasBallPossession(tolerance=0.1)] ], test_timeout_s=30, diff --git a/src/software/ai/hl/stp/play/enemy_free_kick/enemy_free_kick_play_test.py b/src/software/ai/hl/stp/play/enemy_free_kick/enemy_free_kick_play_test.py index 3eda2ffba2..6b08210f5b 100644 --- a/src/software/ai/hl/stp/play/enemy_free_kick/enemy_free_kick_play_test.py +++ b/src/software/ai/hl/stp/play/enemy_free_kick/enemy_free_kick_play_test.py @@ -143,8 +143,8 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validation_sequence_set, - inv_always_validation_sequence_set=always_validation_sequence_set, + eventually_validation_sequence_set=eventually_validation_sequence_set, + always_validation_sequence_set=always_validation_sequence_set, test_timeout_s=8, ) diff --git a/src/software/ai/hl/stp/play/example/example_play_test.py b/src/software/ai/hl/stp/play/example/example_play_test.py index 12ddba899f..8c030a9ce0 100644 --- a/src/software/ai/hl/stp/play/example/example_play_test.py +++ b/src/software/ai/hl/stp/play/example/example_play_test.py @@ -74,8 +74,7 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validations, - ag_eventually_validation_sequence_set=eventually_validations, + eventually_validation_sequence_set=eventually_validations, test_timeout_s=10, ) diff --git a/src/software/ai/hl/stp/play/free_kick/free_kick_play_test.py b/src/software/ai/hl/stp/play/free_kick/free_kick_play_test.py index 6e4c5a296b..2e4e186fee 100644 --- a/src/software/ai/hl/stp/play/free_kick/free_kick_play_test.py +++ b/src/software/ai/hl/stp/play/free_kick/free_kick_play_test.py @@ -91,8 +91,7 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validations, - ag_eventually_validation_sequence_set=eventually_validations, + eventually_validation_sequence_set=eventually_validations, test_timeout_s=10, ) diff --git a/src/software/ai/hl/stp/play/halt_play/halt_play_test.py b/src/software/ai/hl/stp/play/halt_play/halt_play_test.py index 4e0716427d..38a92593ce 100644 --- a/src/software/ai/hl/stp/play/halt_play/halt_play_test.py +++ b/src/software/ai/hl/stp/play/halt_play/halt_play_test.py @@ -51,13 +51,9 @@ def setup(): gc_command=Command.Type.FORCE_START, team=Team.UNKNOWN ) - # params just have to be a list of length 1 to ensure the test runs at least once gameplay_test_runner.run_test( setup=setup, - inv_always_validation_sequence_set=[[]], - inv_eventually_validation_sequence_set=[ - [RobotSpeedEventuallyBelowThreshold(1e-3)] - ], + eventually_validation_sequence_set=[[RobotSpeedEventuallyBelowThreshold(1e-3)]], ci_cmd_with_delay=[ (3, Command.Type.HALT, Team.BLUE), (3, Command.Type.HALT, Team.YELLOW), diff --git a/src/software/ai/hl/stp/play/kickoff_enemy/kickoff_enemy_play_test.py b/src/software/ai/hl/stp/play/kickoff_enemy/kickoff_enemy_play_test.py index e6a221f2ee..08753d4ca5 100644 --- a/src/software/ai/hl/stp/play/kickoff_enemy/kickoff_enemy_play_test.py +++ b/src/software/ai/hl/stp/play/kickoff_enemy/kickoff_enemy_play_test.py @@ -140,10 +140,8 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validation_sequence_set, - inv_always_validation_sequence_set=always_validation_sequence_set, - ag_eventually_validation_sequence_set=eventually_validation_sequence_set, - ag_always_validation_sequence_set=always_validation_sequence_set, + eventually_validation_sequence_set=eventually_validation_sequence_set, + always_validation_sequence_set=always_validation_sequence_set, test_timeout_s=10, ) diff --git a/src/software/ai/hl/stp/play/kickoff_friendly/kickoff_friendly_play_test.py b/src/software/ai/hl/stp/play/kickoff_friendly/kickoff_friendly_play_test.py index be926e7353..87515802eb 100644 --- a/src/software/ai/hl/stp/play/kickoff_friendly/kickoff_friendly_play_test.py +++ b/src/software/ai/hl/stp/play/kickoff_friendly/kickoff_friendly_play_test.py @@ -140,10 +140,8 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validation_sequence_set, - inv_always_validation_sequence_set=always_validation_sequence_set, - ag_eventually_validation_sequence_set=eventually_validation_sequence_set, - ag_always_validation_sequence_set=always_validation_sequence_set, + eventually_validation_sequence_set=eventually_validation_sequence_set, + always_validation_sequence_set=always_validation_sequence_set, test_timeout_s=10, ) diff --git a/src/software/ai/hl/stp/play/kickoff_play_test.py b/src/software/ai/hl/stp/play/kickoff_play_test.py index 165f0ea70d..80cbc15057 100644 --- a/src/software/ai/hl/stp/play/kickoff_play_test.py +++ b/src/software/ai/hl/stp/play/kickoff_play_test.py @@ -138,8 +138,8 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validation_sequence_set, - inv_always_validation_sequence_set=always_validation_sequence_set, + eventually_validation_sequence_set=eventually_validation_sequence_set, + always_validation_sequence_set=always_validation_sequence_set, test_timeout_s=10, ) diff --git a/src/software/ai/hl/stp/play/offense/offense_play_test.py b/src/software/ai/hl/stp/play/offense/offense_play_test.py index 5deb7427d1..4ddfb9a82b 100644 --- a/src/software/ai/hl/stp/play/offense/offense_play_test.py +++ b/src/software/ai/hl/stp/play/offense/offense_play_test.py @@ -60,18 +60,14 @@ def setup(): field = tbots_cpp.Field.createSSLDivisionBField() # Always Validation - inv_always_validation_sequence_set = [ + always_validation_sequence_set = [ [BallAlwaysStaysInRegion(regions=[field.fieldBoundary()])], [NeverExcessivelyDribbles()], ] - # Eventually Validation - inv_eventually_validation_sequence_set = [[]] - gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=inv_eventually_validation_sequence_set, - inv_always_validation_sequence_set=inv_always_validation_sequence_set, + always_validation_sequence_set=always_validation_sequence_set, test_timeout_s=15, run_till_end=True, ) diff --git a/src/software/ai/hl/stp/play/passing_sim_test.py b/src/software/ai/hl/stp/play/passing_sim_test.py index bd6bf91847..f549a9aded 100644 --- a/src/software/ai/hl/stp/play/passing_sim_test.py +++ b/src/software/ai/hl/stp/play/passing_sim_test.py @@ -246,7 +246,7 @@ def test_passing_receive_speed( ] gameplay_test_runner.run_test( - setup=lambda param: setup_pass_and_robots( + setup=lambda: setup_pass_and_robots( ball_initial_position=ball_initial_position, ball_initial_velocity=ball_initial_velocity, attacker_robot_position=attacker_robot_position, @@ -381,8 +381,8 @@ def test_passing_no_backwards_passes( ] gameplay_test_runner.run_test( - inv_eventually_validation_sequence_set=eventually_validation_sequence_set, - inv_always_validation_sequence_set=always_validation_sequence_set, + eventually_validation_sequence_set=eventually_validation_sequence_set, + always_validation_sequence_set=always_validation_sequence_set, test_timeout_s=10, run_till_end=False, ) diff --git a/src/software/ai/hl/stp/play/penalty_kick_enemy/penalty_kick_enemy_play_test.py b/src/software/ai/hl/stp/play/penalty_kick_enemy/penalty_kick_enemy_play_test.py index 0ccc8a48a7..83ce5e85fa 100644 --- a/src/software/ai/hl/stp/play/penalty_kick_enemy/penalty_kick_enemy_play_test.py +++ b/src/software/ai/hl/stp/play/penalty_kick_enemy/penalty_kick_enemy_play_test.py @@ -173,8 +173,7 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validation_sequence_set, - ag_eventually_validation_sequence_set=eventually_validation_sequence_set, + eventually_validation_sequence_set=eventually_validation_sequence_set, test_timeout_s=20, ) diff --git a/src/software/ai/hl/stp/play/shoot_or_chip/shoot_or_chip_play_test.py b/src/software/ai/hl/stp/play/shoot_or_chip/shoot_or_chip_play_test.py index c8834480c6..7c9b12fd06 100644 --- a/src/software/ai/hl/stp/play/shoot_or_chip/shoot_or_chip_play_test.py +++ b/src/software/ai/hl/stp/play/shoot_or_chip/shoot_or_chip_play_test.py @@ -64,8 +64,6 @@ def setup(): # TODO (#3651): add validations gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=[[]], - ag_eventually_validation_sequence_set=[[]], test_timeout_s=10, ) diff --git a/src/software/ai/hl/stp/play/shoot_or_pass/shoot_or_pass_play_test.py b/src/software/ai/hl/stp/play/shoot_or_pass/shoot_or_pass_play_test.py index d7e82eb22b..1f69af1708 100644 --- a/src/software/ai/hl/stp/play/shoot_or_pass/shoot_or_pass_play_test.py +++ b/src/software/ai/hl/stp/play/shoot_or_pass/shoot_or_pass_play_test.py @@ -57,8 +57,7 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validations, - ag_eventually_validation_sequence_set=eventually_validations, + eventually_validation_sequence_set=eventually_validations, test_timeout_s=15, run_till_end=False, ) diff --git a/src/software/ai/hl/stp/play/stop_play_test.py b/src/software/ai/hl/stp/play/stop_play_test.py index a5daeb470b..5eee0982cd 100644 --- a/src/software/ai/hl/stp/play/stop_play_test.py +++ b/src/software/ai/hl/stp/play/stop_play_test.py @@ -165,8 +165,7 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_always_validation_sequence_set=always_stop_play_rules, - ag_always_validation_sequence_set=always_stop_play_rules, + always_validation_sequence_set=always_stop_play_rules, test_timeout_s=6, ) diff --git a/src/software/ai/hl/stp/tactic/attacker/attacker_tactic_test.py b/src/software/ai/hl/stp/tactic/attacker/attacker_tactic_test.py index faaca151b1..2215d861ed 100644 --- a/src/software/ai/hl/stp/tactic/attacker/attacker_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/attacker/attacker_tactic_test.py @@ -168,8 +168,7 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validation_sequence_set, - ag_eventually_validation_sequence_set=eventually_validation_sequence_set, + eventually_validation_sequence_set=eventually_validation_sequence_set, run_till_end=False, test_timeout_s=7, ) @@ -279,8 +278,7 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_always_validation_sequence_set=always_validation_sequence_set, - ag_always_validation_sequence_set=always_validation_sequence_set, + always_validation_sequence_set=always_validation_sequence_set, ) @@ -380,8 +378,7 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validation_sequence_set, - ag_eventually_validation_sequence_set=eventually_validation_sequence_set, + eventually_validation_sequence_set=eventually_validation_sequence_set, run_till_end=False, test_timeout_s=9, ) diff --git a/src/software/ai/hl/stp/tactic/chip/chip_tactic_test.py b/src/software/ai/hl/stp/tactic/chip/chip_tactic_test.py index ece6de9595..5baebae99b 100644 --- a/src/software/ai/hl/stp/tactic/chip/chip_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/chip/chip_tactic_test.py @@ -86,8 +86,7 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validations, - ag_eventually_validation_sequence_set=eventually_validations, + eventually_validation_sequence_set=eventually_validations, ) diff --git a/src/software/ai/hl/stp/tactic/crease_defender/crease_defender_tactic_test.py b/src/software/ai/hl/stp/tactic/crease_defender/crease_defender_tactic_test.py index ee84ebac77..f16a8a01eb 100644 --- a/src/software/ai/hl/stp/tactic/crease_defender/crease_defender_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/crease_defender/crease_defender_tactic_test.py @@ -54,8 +54,7 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_always_validation_sequence_set=always_validations, - ag_always_validation_sequence_set=always_validations, + always_validation_sequence_set=always_validations, ) @@ -176,8 +175,7 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validations, - ag_eventually_validation_sequence_set=eventually_validations, + eventually_validation_sequence_set=eventually_validations, test_timeout_s=5, ) @@ -261,10 +259,8 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validation_sequence_set, - inv_always_validation_sequence_set=always_validation_sequence_set, - ag_eventually_validation_sequence_set=eventually_validation_sequence_set, - ag_always_validation_sequence_set=always_validation_sequence_set, + eventually_validation_sequence_set=eventually_validation_sequence_set, + always_validation_sequence_set=always_validation_sequence_set, test_timeout_s=4, ) @@ -358,10 +354,8 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validation_sequence_set, - inv_always_validation_sequence_set=always_validation_sequence_set, - ag_eventually_validation_sequence_set=eventually_validation_sequence_set, - ag_always_validation_sequence_set=always_validation_sequence_set, + eventually_validation_sequence_set=eventually_validation_sequence_set, + always_validation_sequence_set=always_validation_sequence_set, test_timeout_s=3, ) @@ -439,10 +433,8 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validation_sequence_set, - inv_always_validation_sequence_set=always_validation_sequence_set, - ag_eventually_validation_sequence_set=eventually_validation_sequence_set, - ag_always_validation_sequence_set=always_validation_sequence_set, + eventually_validation_sequence_set=eventually_validation_sequence_set, + always_validation_sequence_set=always_validation_sequence_set, ) diff --git a/src/software/ai/hl/stp/tactic/dribble/dribble_tactic_test.py b/src/software/ai/hl/stp/tactic/dribble/dribble_tactic_test.py index 42be5109f9..e53ed80746 100644 --- a/src/software/ai/hl/stp/tactic/dribble/dribble_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/dribble/dribble_tactic_test.py @@ -179,8 +179,7 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validations, - ag_eventually_validation_sequence_set=eventually_validations, + eventually_validation_sequence_set=eventually_validations, test_timeout_s=25, run_till_end=False, ) @@ -332,10 +331,8 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validation_sequence_set, - inv_always_validation_sequence_set=always_validation_sequence_set, - ag_eventually_validation_sequence_set=eventually_validation_sequence_set, - ag_always_validation_sequence_set=always_validation_sequence_set, + eventually_validation_sequence_set=eventually_validation_sequence_set, + always_validation_sequence_set=always_validation_sequence_set, ) @@ -380,8 +377,7 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validation_sequence_set, - ag_eventually_validation_sequence_set=eventually_validation_sequence_set, + eventually_validation_sequence_set=eventually_validation_sequence_set, test_timeout_s=10, ) @@ -431,8 +427,7 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validations, - ag_eventually_validation_sequence_set=eventually_validations, + eventually_validation_sequence_set=eventually_validations, test_timeout_s=10, ) @@ -477,10 +472,8 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validations, - ag_eventually_validation_sequence_set=eventually_validations, - inv_always_validation_sequence_set=always_validations, - ag_always_validation_sequence_set=always_validations, + eventually_validation_sequence_set=eventually_validations, + always_validation_sequence_set=always_validations, ) diff --git a/src/software/ai/hl/stp/tactic/goalie/goalie_tactic_test.py b/src/software/ai/hl/stp/tactic/goalie/goalie_tactic_test.py index baa8787014..dfca076d6d 100644 --- a/src/software/ai/hl/stp/tactic/goalie/goalie_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/goalie/goalie_tactic_test.py @@ -157,10 +157,8 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validation_sequence_set, - inv_always_validation_sequence_set=always_validation_sequence_set, - ag_eventually_validation_sequence_set=eventually_validation_sequence_set, - ag_always_validation_sequence_set=always_validation_sequence_set, + eventually_validation_sequence_set=eventually_validation_sequence_set, + always_validation_sequence_set=always_validation_sequence_set, ) @@ -241,10 +239,8 @@ def setup(): gameplay_test_runner.run_test( setup=setup, test_timeout_s=8, - inv_eventually_validation_sequence_set=eventually_validation_sequence_set, - inv_always_validation_sequence_set=always_validation_sequence_set, - ag_eventually_validation_sequence_set=eventually_validation_sequence_set, - ag_always_validation_sequence_set=always_validation_sequence_set, + eventually_validation_sequence_set=eventually_validation_sequence_set, + always_validation_sequence_set=always_validation_sequence_set, ) diff --git a/src/software/ai/hl/stp/tactic/halt/halt_tactic_test.py b/src/software/ai/hl/stp/tactic/halt/halt_tactic_test.py index db4987d125..d6bed914f8 100644 --- a/src/software/ai/hl/stp/tactic/halt/halt_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/halt/halt_tactic_test.py @@ -63,8 +63,7 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validations, - ag_eventually_validation_sequence_set=eventually_validations, + eventually_validation_sequence_set=eventually_validations, ) diff --git a/src/software/ai/hl/stp/tactic/kick/kick_tactic_test.py b/src/software/ai/hl/stp/tactic/kick/kick_tactic_test.py index 1dc8c764ad..c3deae0e31 100644 --- a/src/software/ai/hl/stp/tactic/kick/kick_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/kick/kick_tactic_test.py @@ -73,8 +73,7 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validations, - ag_eventually_validation_sequence_set=eventually_validations, + eventually_validation_sequence_set=eventually_validations, ) diff --git a/src/software/ai/hl/stp/tactic/pass_defender/pass_defender_tactic_test.py b/src/software/ai/hl/stp/tactic/pass_defender/pass_defender_tactic_test.py index bf98a56272..c7436656ec 100644 --- a/src/software/ai/hl/stp/tactic/pass_defender/pass_defender_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/pass_defender/pass_defender_tactic_test.py @@ -75,10 +75,8 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validation_sequence_set, - inv_always_validation_sequence_set=always_validation_sequence_set, - ag_eventually_validation_sequence_set=eventually_validation_sequence_set, - ag_always_validation_sequence_set=always_validation_sequence_set, + eventually_validation_sequence_set=eventually_validation_sequence_set, + always_validation_sequence_set=always_validation_sequence_set, ) @@ -166,10 +164,8 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validation_sequence_set, - inv_always_validation_sequence_set=always_validation_sequence_set, - ag_eventually_validation_sequence_set=eventually_validation_sequence_set, - ag_always_validation_sequence_set=always_validation_sequence_set, + eventually_validation_sequence_set=eventually_validation_sequence_set, + always_validation_sequence_set=always_validation_sequence_set, ) @@ -287,10 +283,8 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validation_sequence_set, - inv_always_validation_sequence_set=always_validation_sequence_set, - ag_eventually_validation_sequence_set=eventually_validation_sequence_set, - ag_always_validation_sequence_set=always_validation_sequence_set, + eventually_validation_sequence_set=eventually_validation_sequence_set, + always_validation_sequence_set=always_validation_sequence_set, ) diff --git a/src/software/ai/hl/stp/tactic/penalty_kick/penalty_kick_tactic_test.py b/src/software/ai/hl/stp/tactic/penalty_kick/penalty_kick_tactic_test.py index 883816315c..2a2bca523f 100644 --- a/src/software/ai/hl/stp/tactic/penalty_kick/penalty_kick_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/penalty_kick/penalty_kick_tactic_test.py @@ -82,8 +82,8 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validation_sequence_set, - inv_always_validation_sequence_set=always_validation_sequence_set, + eventually_validation_sequence_set=eventually_validation_sequence_set, + always_validation_sequence_set=always_validation_sequence_set, test_timeout_s=10, ) diff --git a/src/software/ai/hl/stp/tactic/pivot_kick/pivot_kick_tactic_test.py b/src/software/ai/hl/stp/tactic/pivot_kick/pivot_kick_tactic_test.py index 61ae9b2ba1..4363d4939c 100644 --- a/src/software/ai/hl/stp/tactic/pivot_kick/pivot_kick_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/pivot_kick/pivot_kick_tactic_test.py @@ -71,10 +71,7 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validation_sequence_set, - inv_always_validation_sequence_set=[[]], - ag_eventually_validation_sequence_set=eventually_validation_sequence_set, - ag_always_validation_sequence_set=[[]], + eventually_validation_sequence_set=eventually_validation_sequence_set, test_timeout_s=5, ) diff --git a/src/software/ai/hl/stp/tactic/receiver/receiver_tactic_test.py b/src/software/ai/hl/stp/tactic/receiver/receiver_tactic_test.py index 4aec176bef..b4e5fd04fd 100644 --- a/src/software/ai/hl/stp/tactic/receiver/receiver_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/receiver/receiver_tactic_test.py @@ -234,8 +234,7 @@ def setup(): gameplay_test_runner.run_test( setup=setup, - inv_eventually_validation_sequence_set=eventually_validation_sequence_set, - ag_eventually_validation_sequence_set=eventually_validation_sequence_set, + eventually_validation_sequence_set=eventually_validation_sequence_set, run_till_end=False, ) diff --git a/src/software/ai/navigator/trajectory/simulated_hrvo_test.py b/src/software/ai/navigator/trajectory/simulated_hrvo_test.py index eeb7b61d67..0c447f724f 100644 --- a/src/software/ai/navigator/trajectory/simulated_hrvo_test.py +++ b/src/software/ai/navigator/trajectory/simulated_hrvo_test.py @@ -491,7 +491,7 @@ def test_robot_movement( ) gameplay_test_runner.run_test( - setup=lambda param: hrvo_setup( + setup=lambda: hrvo_setup( friendly_robot_positions, friendly_robot_destinations, friendly_robots_final_orientations, From 0c76a39f0b27f3ae3c122b0856b4f06ffe20f6ca Mon Sep 17 00:00:00 2001 From: Eric Xiao Date: Sat, 30 May 2026 15:24:26 -0700 Subject: [PATCH 15/18] Add consistent setup parameter to test runners --- src/software/gameplay_tests/field_test_runner.py | 1 + src/software/gameplay_tests/simulated_test_runner.py | 2 +- src/software/gameplay_tests/tbots_test_runner.py | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/software/gameplay_tests/field_test_runner.py b/src/software/gameplay_tests/field_test_runner.py index 9e4c051a60..c9a5555f6b 100644 --- a/src/software/gameplay_tests/field_test_runner.py +++ b/src/software/gameplay_tests/field_test_runner.py @@ -86,6 +86,7 @@ def set_world_state(self, world_state: WorldState): @override def run_test( self, + setup=lambda: None, always_validation_sequence_set=[[]], eventually_validation_sequence_set=[[]], test_timeout_s=3, diff --git a/src/software/gameplay_tests/simulated_test_runner.py b/src/software/gameplay_tests/simulated_test_runner.py index 84f2ad53c4..617883aa31 100644 --- a/src/software/gameplay_tests/simulated_test_runner.py +++ b/src/software/gameplay_tests/simulated_test_runner.py @@ -61,7 +61,7 @@ def set_world_state(self, world_state: WorldState): @override def run_test( self, - setup=(lambda: None), + setup=lambda: None, always_validation_sequence_set=[[]], eventually_validation_sequence_set=[[]], test_timeout_s=3, diff --git a/src/software/gameplay_tests/tbots_test_runner.py b/src/software/gameplay_tests/tbots_test_runner.py index a4fadb6d90..69ff1c7f9e 100644 --- a/src/software/gameplay_tests/tbots_test_runner.py +++ b/src/software/gameplay_tests/tbots_test_runner.py @@ -145,6 +145,7 @@ def set_world_state(self, world_state: WorldState): @abstractmethod def run_test( self, + setup=lambda: None, always_validation_sequence_set=[[]], eventually_validation_sequence_set=[[]], test_timeout_s=3, From 4814a9002233f7734616d38342271cd9659ba2ed Mon Sep 17 00:00:00 2001 From: Eric Xiao Date: Sat, 30 May 2026 15:29:30 -0700 Subject: [PATCH 16/18] Remove field test fixture from old package --- src/software/BUILD | 1 - src/software/conftest.py | 1 - src/software/field_tests/BUILD | 28 +- .../field_tests/field_test_fixture.py | 433 ------------------ .../field_tests/movement_robot_field_test.py | 1 + .../field_tests/passing_field_test.py | 3 +- .../field_tests/pivot_kick_field_test.py | 3 +- 7 files changed, 7 insertions(+), 463 deletions(-) delete mode 100644 src/software/field_tests/field_test_fixture.py diff --git a/src/software/BUILD b/src/software/BUILD index eff57d214b..5f410e59ff 100644 --- a/src/software/BUILD +++ b/src/software/BUILD @@ -125,7 +125,6 @@ py_library( name = "conftest", srcs = ["conftest.py"], deps = [ - "//software/field_tests:field_test_fixture", "//software/gameplay_tests:fixture", ], ) diff --git a/src/software/conftest.py b/src/software/conftest.py index 9061532c9e..aed4da95be 100644 --- a/src/software/conftest.py +++ b/src/software/conftest.py @@ -1,5 +1,4 @@ import pytest # noqa: F401 -from software.field_tests.field_test_fixture import field_test_runner # noqa: F401 from software.gameplay_tests.fixture import gameplay_test_runner # noqa: F401 # Pytest requires that all tests fixtures shared across a package be defined diff --git a/src/software/field_tests/BUILD b/src/software/field_tests/BUILD index dd3704069d..8aefdb45a0 100644 --- a/src/software/field_tests/BUILD +++ b/src/software/field_tests/BUILD @@ -2,31 +2,6 @@ load("@gameplay_tests_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) -py_library( - name = "field_test_fixture", - srcs = [ - "field_test_fixture.py", - ], - data = [ - "//software:py_constants.so", - ], - deps = [ - "//proto:import_all_protos", - "//software/gameplay_tests:tbots_test_runner", - "//software/gameplay_tests/validation:validations", - "//software/logger:py_logger", - "//software/networking/unix:threaded_unix_listener_py", - "//software/networking/unix:threaded_unix_sender_py", - "//software/thunderscope", - "//software/thunderscope:constants", - "//software/thunderscope:estop_helpers", - "//software/thunderscope:robot_communication", - "//software/thunderscope/binary_context_managers:full_system", - "//software/thunderscope/binary_context_managers:game_controller", - "//software/thunderscope/binary_context_managers:simulator", - ], -) - py_test( name = "movement_robot_field_test", srcs = [ @@ -55,7 +30,7 @@ py_test( ], deps = [ "//software:conftest", - "//software/gameplay_tests:tbots_test_runner", + "//software/gameplay_tests:util", "//software/gameplay_tests/validation:validations", requirement("pytest"), ], @@ -68,6 +43,7 @@ py_test( ], deps = [ "//software:conftest", + "//software/gameplay_tests:util", "//software/gameplay_tests/validation:validations", requirement("pytest"), ], diff --git a/src/software/field_tests/field_test_fixture.py b/src/software/field_tests/field_test_fixture.py deleted file mode 100644 index 490bdb10f5..0000000000 --- a/src/software/field_tests/field_test_fixture.py +++ /dev/null @@ -1,433 +0,0 @@ -import queue -import time -import os -import threading - -import pytest -import argparse -from proto.import_all_protos import * - -from software.gameplay_tests.validation import validation -from software.thunderscope.constants import EstopMode, IndividualRobotMode -from software.thunderscope.thunderscope import Thunderscope -from software.thunderscope.proto_unix_io import ProtoUnixIO -from software.thunderscope.binary_context_managers.full_system import FullSystem -from software.thunderscope.binary_context_managers.game_controller import Gamecontroller -from software.thunderscope.wifi_communication_manager import WifiCommunicationManager -from software.logger.logger import create_logger - - -from software.thunderscope.thunderscope_config import configure_field_test_view -from software.gameplay_tests.tbots_test_runner import TbotsTestRunner -from software.thunderscope.robot_communication import RobotCommunication -from software.thunderscope.estop_helpers import get_estop_config -from software.py_constants import * -from typing import override - -logger = create_logger(__name__) - -WORLD_BUFFER_TIMEOUT = 5.0 -PROCESS_BUFFER_DELAY_S = 0.01 -PAUSE_AFTER_FAIL_DELAY_S = 3 -LAUNCH_DELAY_S = 0.1 -TEST_END_DELAY = 0.3 - - -class FieldTestRunner(TbotsTestRunner): - """Run a field test""" - - def __init__( - self, - test_name, - thunderscope, - blue_full_system_proto_unix_io, - yellow_full_system_proto_unix_io, - gamecontroller, - publish_validation_protos=True, - is_yellow_friendly=False, - ): - """Initialize the FieldTestRunner - - :param test_name: The name of the test to run - :param thunderscope: The Thunderscope to use, None if not used - :param blue_full_system_proto_unix_io: The blue full system proto unix io to use - :param yellow_full_system_proto_unix_io: The yellow full system proto unix io to use - :param gamecontroller: The gamecontroller context managed instance - :param publish_validation_protos: whether to publish validation protos - :param: is_yellow_friendly: if yellow is the friendly team - """ - super(FieldTestRunner, self).__init__( - test_name, - thunderscope, - blue_full_system_proto_unix_io, - yellow_full_system_proto_unix_io, - gamecontroller, - is_yellow_friendly, - ) - self.publish_validation_protos = publish_validation_protos - self.is_yellow_friendly = is_yellow_friendly - - logger.info("determining robots on field") - # survey field for available robot ids - try: - world = self.world_buffer.get(block=True, timeout=WORLD_BUFFER_TIMEOUT) - self.initial_world = world - self.friendly_robot_ids_field = [ - robot.id for robot in world.friendly_team.team_robots - ] - - logger.info(f"friendly team ids {self.friendly_robot_ids_field}") - - if len(self.friendly_robot_ids_field) == 0: - raise Exception("no friendly robots found on field") - - except queue.Empty: - raise Exception( - f"No Worlds were received with in {WORLD_BUFFER_TIMEOUT} seconds. Please make sure atleast 1 robot and 1 ball is present on the field." - ) - - @override - def send_gamecontroller_command( - self, - gc_command: proto.ssl_gc_state_pb2.Command, - team: proto.ssl_gc_common_pb2.Team, - final_ball_placement_point=None, - ): - """Send a command to the gamecontroller - - :param gc_command: The command to send - :param team: The team which the command as attributed to - :param final_ball_placement_point: The ball placement point - """ - self.gamecontroller.send_ci_input( - gc_command=gc_command, - team=team, - final_ball_placement_point=final_ball_placement_point, - ) - - @override - def run_test( - self, - always_validation_sequence_set=[[]], - eventually_validation_sequence_set=[[]], - test_timeout_s=3, - ): - """Run a test. In a field test this means beginning validation. - - :param always_validation_sequence_set: Validation functions that should - hold on every tick - :param eventually_validation_sequence_set: Validation that should - eventually be true, before the test ends - :param test_timeout_s: The timeout for the test, if any eventually_validations - remain after the timeout, the test fails. - """ - - def stop_test(delay): - time.sleep(delay) - if self.thunderscope: - self.thunderscope.close() - - def __runner(): - time.sleep(LAUNCH_DELAY_S) - - test_end_time = time.time() + test_timeout_s - - while time.time() < test_end_time: - while True: - try: - world = self.world_buffer.get( - block=True, timeout=WORLD_BUFFER_TIMEOUT - ) - break - except queue.Empty: - # If we timeout, that means full_system missed the last - # wrapper and robot status, lets resend it. - logger.warning( - f"No World was received for {WORLD_BUFFER_TIMEOUT} seconds. Ending test early." - ) - - # Validate - ( - eventually_validation_proto_set, - always_validation_proto_set, - ) = validation.run_validation_sequence_sets( - world, - eventually_validation_sequence_set, - always_validation_sequence_set, - ) - - if self.publish_validation_protos: - # Set the test name - eventually_validation_proto_set.test_name = self.test_name - always_validation_proto_set.test_name = self.test_name - - # Send out the validation proto to thunderscope - self.blue_full_system_proto_unix_io.send_proto( - ValidationProtoSet, eventually_validation_proto_set - ) - self.blue_full_system_proto_unix_io.send_proto( - ValidationProtoSet, always_validation_proto_set - ) - - # Check that all always validations are always valid - validation.check_validation(always_validation_proto_set) - - # Check that all eventually validations are eventually valid - validation.check_validation(eventually_validation_proto_set) - stop_test(TEST_END_DELAY) - - def excepthook(args): - """This function is _critical_ for show_thunderscope to work. - If the test Thread will raises an exception we won't be able to close - the window from the main thread. - - :param args: The args passed in from the hook - """ - stop_test(delay=PAUSE_AFTER_FAIL_DELAY_S) - self.last_exception = args.exc_value - raise self.last_exception - - threading.excepthook = excepthook - - if self.thunderscope: - run_test_thread = threading.Thread(target=__runner, daemon=True) - run_test_thread.start() - self.thunderscope.show() - run_test_thread.join() - - if self.last_exception: - pytest.fail(str(ex.last_exception)) - - else: - __runner() - - -def load_command_line_arguments(): - """Load in command-line arguments using argparse - - NOTE: Pytest has its own built in argument parser (conftest.py, pytest_addoption) - but it doesn't seem to play nicely with bazel. We just use argparse instead. - """ - parser = argparse.ArgumentParser(description="Run simulated or field pytests") - parser.add_argument( - "--simulator_runtime_dir", - type=str, - help="simulator runtime directory", - default="/tmp/tbots", - ) - parser.add_argument( - "--blue_full_system_runtime_dir", - type=str, - help="blue full_system runtime directory", - default="/tmp/tbots/blue", - ) - parser.add_argument( - "--yellow_full_system_runtime_dir", - type=str, - help="yellow full_system runtime directory", - default="/tmp/tbots/yellow", - ) - parser.add_argument( - "--layout", - action="store", - help="Which layout to run, if not specified the last layout will run", - ) - parser.add_argument( - "--debug_blue_full_system", - action="store_true", - default=False, - help="Debug blue full_system", - ) - parser.add_argument( - "--debug_yellow_full_system", - action="store_true", - default=False, - help="Debug yellow full_system", - ) - parser.add_argument( - "--debug_simulator", - action="store_true", - default=False, - help="Debug the simulator", - ) - parser.add_argument( - "--visualization_buffer_size", - action="store", - type=int, - default=5, - help="How many packets to buffer while rendering", - ) - parser.add_argument( - "--show_gamecontroller_logs", - action="store_true", - default=False, - help="How many packets to buffer while rendering", - ) - parser.add_argument( - "--run_field_test", - action="store_true", - default=False, - help="whether to run test as a field test instead of a simulated test", - ) - parser.add_argument( - "--test_filter", - action="store", - default="", - help="The test filter, if not specified all tests will run. " - + "See https://docs.pytest.org/en/latest/how-to/usage.html#specifying-tests-selecting-tests", - ) - - parser.add_argument( - "--interface", - action="store", - type=str, - default=None, - help="Which interface to communicate over", - ) - - parser.add_argument( - "--channel", - action="store", - type=int, - default=0, - help="Which channel to communicate over", - ) - - parser.add_argument( - "--estop_baudrate", - action="store", - type=int, - default=115200, - help="Estop Baudrate", - ) - - parser.add_argument( - "--run_yellow", - action="store_true", - default=False, - help="Run the test with friendly robots in yellow mode", - ) - - estop_group = parser.add_mutually_exclusive_group() - estop_group.add_argument( - "--keyboard_estop", - action="store_true", - default=False, - help="Allows the use of the spacebar as an estop instead of a physical one", - ) - estop_group.add_argument( - "--disable_communication", - action="store_true", - default=False, - help="Disables checking for estop plugged in (ONLY USE FOR LOCAL TESTING)", - ) - - return parser.parse_args() - - -@pytest.fixture -def field_test_runner(): - """Runs a field test - - :return: yields the runner to the test fixture - """ - simulator_proto_unix_io = ProtoUnixIO() - yellow_full_system_proto_unix_io = ProtoUnixIO() - blue_full_system_proto_unix_io = ProtoUnixIO() - args = load_command_line_arguments() - - # Grab the current test name to store the proto log for the test case - current_test = os.environ.get("PYTEST_CURRENT_TEST").split(":")[-1].split(" ")[0] - current_test = current_test.replace("]", "") - current_test = current_test.replace("[", "-") - - test_name = current_test.split("-")[0] - debug_full_sys = args.debug_blue_full_system - runtime_dir = f"{args.blue_full_system_runtime_dir}/test/{test_name}" - friendly_proto_unix_io = blue_full_system_proto_unix_io - - if args.run_yellow: - debug_full_sys = args.debug_yellow_full_system - runtime_dir = f"{args.yellow_full_system_runtime_dir}/test/{test_name}" - friendly_proto_unix_io = yellow_full_system_proto_unix_io - - estop_mode, estop_path = get_estop_config( - args.keyboard_estop, args.disable_communication - ) - - # Launch all binaries - with FullSystem( - "software/unix_full_system", - full_system_runtime_dir=runtime_dir, - debug_full_system=debug_full_sys, - friendly_colour_yellow=args.run_yellow, - should_restart_on_crash=False, - ) as friendly_fs, Gamecontroller( - # we would be using conventional port if and only if we are playing in robocup. - suppress_logs=(not args.show_gamecontroller_logs), - use_conventional_port=False, - ) as gamecontroller, WifiCommunicationManager( - current_proto_unix_io=friendly_proto_unix_io, - multicast_channel=getRobotMulticastChannel(args.channel), - should_setup_full_system=True, - interface=args.interface, - referee_port=gamecontroller.get_referee_port() - if gamecontroller - else SSL_REFEREE_PORT, - ) as wifi_communication_manager, RobotCommunication( - current_proto_unix_io=friendly_proto_unix_io, - communication_manager=wifi_communication_manager, - estop_mode=estop_mode, - estop_path=estop_path, - ) as rc_friendly: - friendly_fs.setup_proto_unix_io(friendly_proto_unix_io) - - gamecontroller.setup_proto_unix_io( - blue_full_system_proto_unix_io=blue_full_system_proto_unix_io, - yellow_full_system_proto_unix_io=yellow_full_system_proto_unix_io, - simulator_proto_unix_io=simulator_proto_unix_io, - ) - # Inject the proto unix ios into thunderscope and start the test - tscope = Thunderscope( - configure_field_test_view( - simulator_proto_unix_io=simulator_proto_unix_io, - blue_full_system_proto_unix_io=blue_full_system_proto_unix_io, - yellow_full_system_proto_unix_io=yellow_full_system_proto_unix_io, - yellow_is_friendly=args.run_yellow, - ), - layout_path=None, - ) - - # Set control mode for all robots to AI so that packets are sent to the robots - for robot_id in range(MAX_ROBOT_IDS_PER_SIDE): - rc_friendly.toggle_individual_robot_control_mode( - robot_id, - IndividualRobotMode.AI, - ) - - # connect the keyboard estop toggle to the key event if needed - if estop_mode == EstopMode.KEYBOARD_ESTOP: - tscope.keyboard_estop_shortcut.activated.connect( - rc_friendly.toggle_keyboard_estop - ) - # we call this method to enable estop automatically when a field test starts - rc_friendly.toggle_keyboard_estop() - logger.warning( - "\x1b[31;20m" - + "Keyboard Estop Enabled, robots will start moving automatically when test starts!" - + "\x1b[0m" - ) - - time.sleep(LAUNCH_DELAY_S) - runner = FieldTestRunner( - test_name=current_test, - blue_full_system_proto_unix_io=blue_full_system_proto_unix_io, - yellow_full_system_proto_unix_io=yellow_full_system_proto_unix_io, - gamecontroller=gamecontroller, - thunderscope=tscope, - is_yellow_friendly=args.run_yellow, - ) - - friendly_proto_unix_io.register_observer(World, runner.world_buffer) - - yield runner diff --git a/src/software/field_tests/movement_robot_field_test.py b/src/software/field_tests/movement_robot_field_test.py index 1da87720b2..a834eeade4 100644 --- a/src/software/field_tests/movement_robot_field_test.py +++ b/src/software/field_tests/movement_robot_field_test.py @@ -10,6 +10,7 @@ logger = create_logger(__name__) +# TODO(#3744) # TODO(#2908): Support running this test in both simulator or field mode # this test can be run either in simulation or on the field diff --git a/src/software/field_tests/passing_field_test.py b/src/software/field_tests/passing_field_test.py index 97d0e4e459..e6e2ab13fe 100644 --- a/src/software/field_tests/passing_field_test.py +++ b/src/software/field_tests/passing_field_test.py @@ -1,6 +1,6 @@ import software.python_bindings as tbots_cpp from proto.import_all_protos import * -from software.field_tests.field_test_fixture import * +from software.gameplay_tests.util import * from software.gameplay_tests.validation.friendly_receives_ball_slow import ( FriendlyAlwaysReceivesBallSlow, ) @@ -8,6 +8,7 @@ pytest_main, ) +# TODO(#3744) def test_passing(field_test_runner): passer_robot_id = 3 diff --git a/src/software/field_tests/pivot_kick_field_test.py b/src/software/field_tests/pivot_kick_field_test.py index bc820b3c03..553e1f0cb0 100644 --- a/src/software/field_tests/pivot_kick_field_test.py +++ b/src/software/field_tests/pivot_kick_field_test.py @@ -1,6 +1,6 @@ import math from proto.import_all_protos import * -from software.field_tests.field_test_fixture import * +from software.gameplay_tests.util import * from software.gameplay_tests.util import * from software.logger.logger import create_logger @@ -10,6 +10,7 @@ logger = create_logger(__name__) +# TODO(#3744) def test_pivot_kick(field_test_runner): id = 5 From 7446c56b4b9ca9d6a214c4f6943903ea27583094 Mon Sep 17 00:00:00 2001 From: Eric Xiao Date: Sat, 30 May 2026 15:33:16 -0700 Subject: [PATCH 17/18] Fix BUILD deps --- src/software/gameplay_tests/BUILD | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/software/gameplay_tests/BUILD b/src/software/gameplay_tests/BUILD index 252002b354..8298fdf4cf 100644 --- a/src/software/gameplay_tests/BUILD +++ b/src/software/gameplay_tests/BUILD @@ -54,7 +54,9 @@ py_library( srcs = [ "field_test_runner.py", ], - deps = [], + deps = [ + ":tbots_test_runner" + ], ) py_library( @@ -62,7 +64,9 @@ py_library( srcs = [ "simulated_test_runner.py", ], - deps = [], + deps = [ + ":tbots_test_runner" + ], ) py_library( From db5f8e2f1becfe75be6853c03db449c81f3d4862 Mon Sep 17 00:00:00 2001 From: Eric Xiao Date: Sat, 30 May 2026 17:37:25 -0700 Subject: [PATCH 18/18] Rewrite movement robot field test like sim test --- .../field_tests/movement_robot_field_test.py | 92 +++++++++---------- 1 file changed, 45 insertions(+), 47 deletions(-) diff --git a/src/software/field_tests/movement_robot_field_test.py b/src/software/field_tests/movement_robot_field_test.py index a834eeade4..d4455839ef 100644 --- a/src/software/field_tests/movement_robot_field_test.py +++ b/src/software/field_tests/movement_robot_field_test.py @@ -6,6 +6,10 @@ from proto.import_all_protos import * from proto.message_translation.tbots_protobuf import create_world_state from software.gameplay_tests.util import pytest_main +from software.gameplay_tests.validation.robot_enters_region import ( + RobotEventuallyEntersRegion, +) +from software.gameplay_tests.validation.delay_validation import DelayValidation from software.logger.logger import create_logger logger = create_logger(__name__) @@ -148,56 +152,50 @@ ], ) def test_one_robots_square(start_position, end_position, gameplay_test_runner): - gameplay_test_runner.set_world_state( - create_world_state( - blue_robot_locations=[ - start_position, - ], - yellow_robot_locations=[], - ball_location=tbots_cpp.Point(0, 0), - ball_velocity=tbots_cpp.Vector(0, 0), - ), - ) - world = gameplay_test_runner.world_buffer.get(block=True, timeout=5.0) - while len(world.friendly_team.team_robots) == 0: - tick = SimulatorTick(milliseconds=1000 / 60) - gameplay_test_runner.simulator_proto_unix_io.send_proto(SimulatorTick, tick) - - world = gameplay_test_runner.world_buffer.get(block=True, timeout=5.0) - print("The first world received had no robots in it!") - # raise Exception("The first world received had no robots in it!") - - print("Here are the robots:") - print( - [ - robot.current_state.global_position - for robot in world.friendly_team.team_robots - ] - ) - - id = world.friendly_team.team_robots[0].id - print(f"Running test on robot {id}") - - tactic = MoveTactic( - destination=tbots_cpp.createPointProto(end_position), - dribbler_mode=DribblerMode.OFF, - final_orientation=Angle(radians=-math.pi / 2), - ball_collision_type=BallCollisionType.AVOID, - auto_chip_or_kick=AutoChipOrKick(autokick_speed_m_per_s=0.0), - max_allowed_speed_mode=MaxAllowedSpeedMode.PHYSICAL_LIMIT, - obstacle_avoidance_mode=ObstacleAvoidanceMode.SAFE, - ) - - print(f"Going to {tactic.destination}") - - gameplay_test_runner.set_tactics( - blue_tactics={ - id: tactic, - }, - ) + def setup(): + gameplay_test_runner.set_world_state( + create_world_state( + blue_robot_locations=[ + start_position, + ], + yellow_robot_locations=[], + ball_location=tbots_cpp.Point(0, 0), + ball_velocity=tbots_cpp.Vector(0, 0), + ), + ) + + tactic = MoveTactic( + destination=tbots_cpp.createPointProto(end_position), + dribbler_mode=DribblerMode.OFF, + final_orientation=Angle(radians=-math.pi / 2), + ball_collision_type=BallCollisionType.AVOID, + auto_chip_or_kick=AutoChipOrKick(autokick_speed_m_per_s=0.0), + max_allowed_speed_mode=MaxAllowedSpeedMode.PHYSICAL_LIMIT, + obstacle_avoidance_mode=ObstacleAvoidanceMode.SAFE, + ) + + gameplay_test_runner.set_tactics( + blue_tactics={ + 0: tactic, + }, + ) gameplay_test_runner.run_test( + setup=setup, test_timeout_s=4, + eventually_validation_sequence_set=[ + [ + RobotEventuallyEntersRegion( + regions=[tbots_cpp.Circle(end_position, 0.05)] + ), + DelayValidation( + delay_s=1, + validation=RobotEventuallyEntersRegion( + regions=[tbots_cpp.Circle(end_position, 0.05)] + ), + ), + ] + ], )