Skip to content

Commit bc5e720

Browse files
Muxitepre-commit-ci-lite[bot]williamckha
authored
Fixed SimulatedTestRunner delayed commands and fixed halt_play_test.py (UBC-Thunderbots#3478)
* fixed simulated test runner's delayed ci cmd. * [pre-commit.ci lite] apply automatic fixes * removed unneeded import * removed unneeded import * Update docstring * Update docstring * Upgrade ansible and ansible-lint so that CI passes --------- Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Co-authored-by: williamckha <williamha@outlook.com>
1 parent 9b4aa32 commit bc5e720

7 files changed

Lines changed: 30 additions & 24 deletions

File tree

environment_setup/ubuntu20_requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ansible-lint==25.7.0
1+
ansible-lint==25.8.1
22
pyqtgraph==0.13.7
33
pyqt6==6.6.1
44
PyQt6-Qt6==6.6.1

environment_setup/ubuntu22_requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ansible-lint==25.7.0
1+
ansible-lint==25.8.1
22
pyqtgraph==0.13.7
33
pyqt6==6.6.1
44
PyQt6-Qt6==6.6.1

environment_setup/ubuntu24_requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ansible-lint==25.7.0
1+
ansible-lint==25.8.1
22
pyqtgraph==0.13.7
33
thefuzz==0.19.0
44
iterfzf==0.5.0.20.0

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ def setup(*args):
4646
gc_command=Command.Type.FORCE_START, team=Team.UNKNOWN
4747
)
4848

49-
# Structure for a delayed call is tuple (delay in seconds, command, team)
50-
(3, Command.Type.HALT, Team.BLUE)
51-
(3, Command.Type.HALT, Team.YELLOW)
52-
5349
# No plays to override. AI does whatever for 3 seconds before HALT CMD
5450
# is issued
5551

@@ -76,6 +72,10 @@ def setup(*args):
7672
ag_eventually_validation_sequence_set=[
7773
[RobotSpeedEventuallyBelowThreshold(1e-3)]
7874
],
75+
ci_cmd_with_delay=[
76+
(3, Command.Type.HALT, Team.BLUE),
77+
(3, Command.Type.HALT, Team.YELLOW),
78+
],
7979
test_timeout_s=10,
8080
)
8181

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ansible==10.5.0
1+
ansible==11.9.0

src/software/embedded/ansible/requirements_lock.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
#
55
# bazel run //software/embedded/ansible:requirements.update
66
#
7-
ansible==10.5.0 \
8-
--hash=sha256:1d10bddba58f1edd0fe0b8e0387e0fafc519535066bb3c919c33b6ea3ec32a0f \
9-
--hash=sha256:ba2045031a7d60c203b6e5fe1f8eaddd53ae076f7ada910e636494384135face
7+
ansible==11.9.0 \
8+
--hash=sha256:528ca5a408f11cf1fea00daea7570e68d40e167be38b90c119a7cb45729e4921 \
9+
--hash=sha256:79b087ef38105b93e0e092e7013a0f840e154a6a8ce9b5fddd1b47593adc542a
1010
# via -r software/embedded/ansible/requirements.in
11-
ansible-core==2.17.5 \
12-
--hash=sha256:10f165b475cf2bc8d886e532cadb32c52ee6a533649793101d3166bca9bd3ea3 \
13-
--hash=sha256:ae7f51fd13dc9d57c9bcd43ef23f9c255ca8f18f4b5c0011a4f9b724d92c5a8e
11+
ansible-core==2.18.8 \
12+
--hash=sha256:b0766215a96a47ce39933d27e1e996ca2beb54cf1b3907c742d35c913b1f78cd \
13+
--hash=sha256:b60bc23b2f11fd0559a79d10ac152b52f58a18ca1b7be0a620dfe87f34ced689
1414
# via ansible
1515
cffi==1.16.0 \
1616
--hash=sha256:0c9ef6ff37e974b73c25eecc13952c55bceed9112be2d9d938ded8e856138bcc \

src/software/simulated_tests/simulated_test_fixture.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import pytest
99
from proto.import_all_protos import *
1010

11-
1211
from software.simulated_tests import validation
1312
from software.simulated_tests.tbots_test_runner import TbotsTestRunner
1413
from software.thunderscope.thunderscope import Thunderscope
@@ -107,13 +106,12 @@ def runner(
107106
:param test_timeout_s: The timeout for the test, if any eventually_validations
108107
remain after the timeout, the test fails.
109108
:param tick_duration_s: The simulation step duration
110-
:param ci_cmd_with_delay: A list consisting of a duration, and a
111-
tuple forming a ci command
112-
{
113-
(time, command, team),
114-
(time, command, team),
115-
...
116-
}
109+
:param ci_cmd_with_delay: A list consisting of tuples with a duration and CI command, e.g.
110+
[
111+
(time, command, team),
112+
(time, command, team),
113+
...
114+
]
117115
:param run_till_end: If true, test runs till the end even if eventually validation passes
118116
If false, test stops once eventually validation passes and fails if time out
119117
"""
@@ -130,7 +128,7 @@ def runner(
130128
# If delay matches time
131129
if delay <= time_elapsed_s:
132130
# send command
133-
self.gamecontroller.send_ci_input(cmd, team)
131+
self.gamecontroller.send_gc_command(gc_command=cmd, team=team)
134132
# remove command from the list
135133
ci_cmd_with_delay.remove((delay, cmd, team))
136134

@@ -233,6 +231,7 @@ def run_test(
233231
test_timeout_s=3,
234232
tick_duration_s=0.0166,
235233
index=0,
234+
ci_cmd_with_delay=[],
236235
run_till_end=True,
237236
**kwargs,
238237
):
@@ -244,6 +243,12 @@ def run_test(
244243
:param tick_duration_s: length of a tick
245244
:param index: index of the current test. default is 0 (invariant test)
246245
values can be passed in during aggregate testing for different timeout durations
246+
:param ci_cmd_with_delay: A list consisting of tuples with a duration and CI command, e.g.
247+
[
248+
(time, command, team),
249+
(time, command, team),
250+
...
251+
]
247252
:param run_till_end: If true, test runs till the end even if eventually validation passes
248253
If false, test stops once eventually validation passes and fails if time out
249254
"""
@@ -271,7 +276,7 @@ def run_test(
271276
eventually_validation_sequence_set,
272277
test_timeout_duration,
273278
tick_duration_s,
274-
[],
279+
ci_cmd_with_delay,
275280
run_till_end,
276281
],
277282
)
@@ -289,6 +294,7 @@ def run_test(
289294
eventually_validation_sequence_set,
290295
test_timeout_duration,
291296
tick_duration_s,
297+
ci_cmd_with_delay=ci_cmd_with_delay,
292298
run_till_end=run_till_end,
293299
)
294300

0 commit comments

Comments
 (0)