Skip to content

Commit fab60de

Browse files
committed
Remove physics engine reference after test is done
1 parent 07ba9aa commit fab60de

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pyfrc/test_support/pytest_plugin.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ def robotInit(self):
5454
self._robot_file = robot_file
5555
self._robot_class = TestRobot
5656

57+
self._physics = physics
58+
5759
if physics:
5860
physics.log_init_errors = False
5961

@@ -100,6 +102,11 @@ def robot(self):
100102
# Tests only get a proxy to ensure cleanup is more reliable
101103
yield weakref.proxy(robot)
102104

105+
# reset engine to ensure it gets cleaned up too
106+
# -> might be holding wpilib objects, or the robot
107+
if self._physics:
108+
self._physics.engine = None
109+
103110
del robot
104111

105112
# Double-check all objects are destroyed so that HAL handles are released

0 commit comments

Comments
 (0)