2525 commands2 = None
2626
2727
28-
2928@pytest .fixture
3029def cfg_logging (caplog ):
3130 caplog .set_level (logging .INFO )
@@ -50,8 +49,11 @@ def nt(cfg_logging, wpilib_state):
5049 instance .stopLocal ()
5150 instance ._reset ()
5251
52+
5353@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 :
5557 # attach physics
5658
5759 robotClass = myrobot_class
@@ -74,13 +76,13 @@ def robotInit(self):
7476 finally :
7577 self .__robotInitialized ()
7678
77-
7879 TestRobot .__name__ = robotClass .__name__
7980 TestRobot .__module__ = robotClass .__module__
8081 TestRobot .__qualname__ = robotClass .__qualname__
8182
8283 return (physicsInterface , TestRobot )
8384
85+
8486@pytest .fixture (scope = "function" , autouse = False )
8587def robot_with_sim_setup_teardown (physics_and_decorated_robot_class ):
8688 """
@@ -119,7 +121,7 @@ def robot_with_sim_setup_teardown(physics_and_decorated_robot_class):
119121 yield weakref .proxy (robot )
120122
121123 # If running in separate processes, no need to do cleanup
122- #if ISOLATED:
124+ # if ISOLATED:
123125 # # .. and funny enough, in isolated mode we *don't* want the
124126 # # robot to be cleaned up, as that can deadlock
125127 # self._saved_robot = robot
@@ -167,9 +169,12 @@ def robot_with_sim_setup_teardown(physics_and_decorated_robot_class):
167169 # and functions will only be called the first time (unless re-registered)
168170 # hal.shutdown()
169171
172+
170173@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 :
172177 """
173178 A pytest fixture that provides control over your robot_with_sim_setup_teardown
174179 """
175- return TestController (reraise , robot_with_sim_setup_teardown )
180+ return TestController (reraise , robot_with_sim_setup_teardown )
0 commit comments