| 73 | _exit.assert_called_with(1) |
| 74 | |
| 75 | def test_gc_race_lost(self): |
| 76 | t = timer2.Timer() |
| 77 | with patch.object(t, "_Timer__is_stopped") as mock_stop_event: |
| 78 | # Mark the timer as shutting down so we escape the run loop, |
| 79 | # mocking the running state so we don't block! |
| 80 | with patch.object(t, "running", new=False): |
| 81 | t.stop() |
| 82 | # Pretend like the interpreter has shutdown and GCed built-in |
| 83 | # modules, causing an exception |
| 84 | mock_stop_event.set.side_effect = TypeError() |
| 85 | t.run() |
| 86 | mock_stop_event.set.assert_called_with() |
| 87 | |
| 88 | def test_test_enter(self): |
| 89 | t = timer2.Timer() |