File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,22 @@ def run_robot(self):
7878 self ._robot_finished = True
7979 robot .endCompetition ()
8080
81+ if isinstance (self ._reraise .exception , RuntimeError ):
82+ if str (self ._reraise .exception ).startswith (
83+ "HAL: A handle parameter was passed incorrectly"
84+ ):
85+ msg = (
86+ "Do not reuse HAL objects in tests! This error may occur if you"
87+ " stored a motor/sensor as a global or as a class variable"
88+ " outside of a method."
89+ )
90+ if hasattr (Exception , "add_note" ):
91+ self ._reraise .exception .add_note (f"*** { msg } " )
92+ else :
93+ e = self ._reraise .exception
94+ self ._reraise .reset ()
95+ raise RuntimeError (msg ) from e
96+
8197 # Increment time by 1 second to ensure that any notifiers fire
8298 stepTimingAsync (1.0 )
8399
@@ -106,7 +122,7 @@ def step_timing(
106122 seconds : float ,
107123 autonomous : bool ,
108124 enabled : bool ,
109- assert_alive : bool = True
125+ assert_alive : bool = True ,
110126 ) -> float :
111127 """
112128 This utility will increment simulated time, while pretending that
You can’t perform that action at this time.
0 commit comments