Skip to content

Commit 18df0c9

Browse files
Unified all py tests (UBC-Thunderbots#3513)
* Unified all py tests * [pre-commit.ci lite] apply automatic fixes * Updated missed files * [pre-commit.ci lite] apply automatic fixes --------- Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
1 parent 796d006 commit 18df0c9

10 files changed

Lines changed: 40 additions & 50 deletions

File tree

src/software/ai/hl/stp/play/crease_defense/crease_defense_play_test.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import sys
2-
3-
import pytest
4-
51
import software.python_bindings as tbots_cpp
62
from proto.play_pb2 import Play, PlayName
73
from proto.import_all_protos import *
84
from proto.message_translation.tbots_protobuf import create_world_state
95
from proto.ssl_gc_common_pb2 import Team
6+
from software.simulated_tests.simulated_test_fixture import (
7+
pytest_main,
8+
)
109

1110

1211
def test_crease_defense_play(simulated_test_runner):
@@ -79,5 +78,4 @@ def test_crease_defense_play(simulated_test_runner):
7978

8079

8180
if __name__ == "__main__":
82-
# Run the test, -s disables all capturing at -vv increases verbosity
83-
sys.exit(pytest.main([__file__, "-svv"]))
81+
pytest_main(__file__)

src/software/ai/hl/stp/play/defense/defense_play_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import sys
2-
31
import pytest
42

53
import software.python_bindings as tbots_cpp
@@ -10,6 +8,9 @@
108
)
119
from proto.message_translation.tbots_protobuf import create_world_state
1210
from proto.ssl_gc_common_pb2 import Team
11+
from software.simulated_tests.simulated_test_fixture import (
12+
pytest_main,
13+
)
1314

1415

1516
@pytest.mark.parametrize(
@@ -170,5 +171,4 @@ def setup(*args):
170171

171172

172173
if __name__ == "__main__":
173-
# Run the test, -s disables all capturing at -vv increases verbosity
174-
sys.exit(pytest.main([__file__, "-svv"]))
174+
pytest_main(__file__)

src/software/ai/hl/stp/play/enemy_free_kick/enemy_free_kick_play_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import sys
2-
31
import pytest
42

53
import software.python_bindings as tbots_cpp
@@ -18,6 +16,9 @@
1816
)
1917
from proto.message_translation.tbots_protobuf import create_world_state
2018
from proto.ssl_gc_common_pb2 import Team
19+
from software.simulated_tests.simulated_test_fixture import (
20+
pytest_main,
21+
)
2122

2223

2324
@pytest.mark.parametrize(
@@ -164,5 +165,4 @@ def setup(*args):
164165

165166

166167
if __name__ == "__main__":
167-
# Run the test, -s disables all capturing at -vv increases verbosity
168-
sys.exit(pytest.main([__file__, "-svv"]))
168+
pytest_main(__file__)

src/software/ai/hl/stp/play/example/example_play_test.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
import sys
2-
3-
import pytest
4-
51
import software.python_bindings as tbots_cpp
62
from software.simulated_tests.robot_enters_region import (
73
NumberOfRobotsEventuallyExitsRegion,
@@ -11,6 +7,9 @@
117
from proto.message_translation.tbots_protobuf import create_world_state
128
from proto.ssl_gc_common_pb2 import Team
139
from proto.play_pb2 import Play, PlayName
10+
from software.simulated_tests.simulated_test_fixture import (
11+
pytest_main,
12+
)
1413

1514

1615
def test_example_play(simulated_test_runner):
@@ -96,5 +95,4 @@ def setup(*args):
9695

9796

9897
if __name__ == "__main__":
99-
# Run the test, -s disables all capturing at -vv increases verbosity
100-
sys.exit(pytest.main([__file__, "-svv"]))
98+
pytest_main(__file__)

src/software/ai/hl/stp/play/free_kick/free_kick_play_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import sys
2-
31
import pytest
42

53
import software.python_bindings as tbots_cpp
@@ -9,6 +7,9 @@
97
from software.simulated_tests.robot_enters_region import RobotEventuallyEntersRegion
108
from proto.message_translation.tbots_protobuf import create_world_state
119
from proto.ssl_gc_common_pb2 import Team
10+
from software.simulated_tests.simulated_test_fixture import (
11+
pytest_main,
12+
)
1213

1314

1415
def free_kick_play_setup(
@@ -243,5 +244,4 @@ def test_free_kick_play_both(simulated_test_runner, ball_initial_pos):
243244

244245

245246
if __name__ == "__main__":
246-
# Run the test, -s disables all capturing at -vv increases verbosity
247-
sys.exit(pytest.main([__file__, "-svv"]))
247+
pytest_main(__file__)

src/software/ai/hl/stp/play/halt_play/halt_play_test.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import sys
2-
3-
import pytest
4-
51
import software.python_bindings as tbots_cpp
62
from software.simulated_tests.robot_speed_threshold import *
73
from proto.message_translation.tbots_protobuf import create_world_state
84
from proto.ssl_gc_common_pb2 import Team
5+
from software.simulated_tests.simulated_test_fixture import (
6+
pytest_main,
7+
)
98

109

1110
# TODO issue #2599 - Remove Duration parameter from test
@@ -81,5 +80,4 @@ def setup(*args):
8180

8281

8382
if __name__ == "__main__":
84-
# Run the test, -s disables all capturing at -vv increases verbosity
85-
sys.exit(pytest.main([__file__, "-svv"]))
83+
pytest_main(__file__)

src/software/ai/hl/stp/play/kickoff_play_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import sys
2-
31
import pytest
42

53
import software.python_bindings as tbots_cpp
@@ -10,6 +8,9 @@
108
from proto.import_all_protos import *
119
from proto.message_translation.tbots_protobuf import create_world_state
1210
from proto.ssl_gc_common_pb2 import Team
11+
from software.simulated_tests.simulated_test_fixture import (
12+
pytest_main,
13+
)
1314
from software.simulated_tests.or_validation import OrValidation
1415

1516

@@ -144,5 +145,4 @@ def test_kickoff_play(simulated_test_runner, is_friendly_test):
144145

145146

146147
if __name__ == "__main__":
147-
# Run the test, -s disables all capturing at -vv increases verbosity
148-
sys.exit(pytest.main([__file__, "-svv"]))
148+
pytest_main(__file__)

src/software/ai/hl/stp/play/offense/offense_play_test.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
import sys
2-
3-
import pytest
4-
51
import software.python_bindings as tbots_cpp
62
from proto.play_pb2 import Play, PlayName
73
from software.simulated_tests.friendly_team_scored import *
84
from software.simulated_tests.ball_enters_region import *
95
from software.simulated_tests.friendly_has_ball_possession import *
106
from proto.message_translation.tbots_protobuf import create_world_state
117
from proto.ssl_gc_common_pb2 import Team
8+
from software.simulated_tests.simulated_test_fixture import (
9+
pytest_main,
10+
)
1211

1312

1413
def test_offense_play(simulated_test_runner):
@@ -99,5 +98,4 @@ def setup(start_point):
9998

10099

101100
if __name__ == "__main__":
102-
# Run the test, -s disables all capturing at -vv increases verbosity
103-
sys.exit(pytest.main([__file__, "-svv"]))
101+
pytest_main(__file__)

src/software/field_tests/passing_field_test.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import pytest
2-
31
import software.python_bindings as tbots_cpp
4-
import sys
52
from proto.import_all_protos import *
63
from software.field_tests.field_test_fixture import *
74
from software.simulated_tests.friendly_receives_ball_slow import (
85
FriendlyAlwaysReceivesBallSlow,
96
)
7+
from software.simulated_tests.simulated_test_fixture import (
8+
pytest_main,
9+
)
1010

1111

1212
def test_passing(field_test_runner):
@@ -105,5 +105,4 @@ def test_passing(field_test_runner):
105105

106106

107107
if __name__ == "__main__":
108-
# Run the test, -s disables all capturing at -vv increases verbosity
109-
sys.exit(pytest.main([__file__, "-svv"]))
108+
pytest_main(__file__)

src/software/field_tests/pivot_kick_field_test.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import pytest
2-
3-
import sys
41
import math
52
from proto.import_all_protos import *
63
from software.field_tests.field_test_fixture import *
74

85
from software.simulated_tests.simulated_test_fixture import *
96
from software.logger.logger import create_logger
7+
from software.simulated_tests.simulated_test_fixture import (
8+
pytest_main,
9+
)
1010

1111
logger = create_logger(__name__)
1212

@@ -45,5 +45,4 @@ def test_pivot_kick(field_test_runner):
4545

4646

4747
if __name__ == "__main__":
48-
# Run the test, -s disables all capturing at -vv increases verbosity
49-
sys.exit(pytest.main([__file__, "-svv"]))
48+
pytest_main(__file__)

0 commit comments

Comments
 (0)