25
25
commands2 = None
26
26
27
27
28
-
29
28
@pytest .fixture
30
29
def cfg_logging (caplog ):
31
30
caplog .set_level (logging .INFO )
@@ -50,8 +49,11 @@ def nt(cfg_logging, wpilib_state):
50
49
instance .stopLocal ()
51
50
instance ._reset ()
52
51
52
+
53
53
@pytest .fixture (scope = "class" , autouse = False )
54
- def physics_and_decorated_robot_class (myrobot_class , robots_sim_enable_physics )-> tuple :
54
+ def physics_and_decorated_robot_class (
55
+ myrobot_class , robots_sim_enable_physics
56
+ ) -> tuple :
55
57
# attach physics
56
58
57
59
robotClass = myrobot_class
@@ -74,13 +76,13 @@ def robotInit(self):
74
76
finally :
75
77
self .__robotInitialized ()
76
78
77
-
78
79
TestRobot .__name__ = robotClass .__name__
79
80
TestRobot .__module__ = robotClass .__module__
80
81
TestRobot .__qualname__ = robotClass .__qualname__
81
82
82
83
return (physicsInterface , TestRobot )
83
84
85
+
84
86
@pytest .fixture (scope = "function" , autouse = False )
85
87
def robot_with_sim_setup_teardown (physics_and_decorated_robot_class ):
86
88
"""
@@ -119,7 +121,7 @@ def robot_with_sim_setup_teardown(physics_and_decorated_robot_class):
119
121
yield weakref .proxy (robot )
120
122
121
123
# If running in separate processes, no need to do cleanup
122
- #if ISOLATED:
124
+ # if ISOLATED:
123
125
# # .. and funny enough, in isolated mode we *don't* want the
124
126
# # robot to be cleaned up, as that can deadlock
125
127
# self._saved_robot = robot
@@ -167,9 +169,12 @@ def robot_with_sim_setup_teardown(physics_and_decorated_robot_class):
167
169
# and functions will only be called the first time (unless re-registered)
168
170
# hal.shutdown()
169
171
172
+
170
173
@pytest .fixture (scope = "function" )
171
- def getTestController (reraise , robot_with_sim_setup_teardown : wpilib .RobotBase ) -> TestController :
174
+ def getTestController (
175
+ reraise , robot_with_sim_setup_teardown : wpilib .RobotBase
176
+ ) -> TestController :
172
177
"""
173
178
A pytest fixture that provides control over your robot_with_sim_setup_teardown
174
179
"""
175
- return TestController (reraise , robot_with_sim_setup_teardown )
180
+ return TestController (reraise , robot_with_sim_setup_teardown )
0 commit comments