Debian Codegraph @

tests/test_coverup_26.py

raw symbols SCIP
1 # file scalene/scalene_profiler.py:565-579
2 # lines [565, 566, 567, 568, 569, 570, 571, 574, 575, 576, 577, 578, 579]
3 # branches []
4
5 import pytest
6 import sys
7 import threading
8 from unittest.mock import patch
9 from scalene.scalene_profiler import Scalene
10
11
12 @pytest.fixture(scope="function")
13 def scalene_cleanup():
14 # Fixture to clean up state after tests
15 yield
16 Scalene.__windows_queue = None
17 Scalene.timer_signals = False
18
19
20 @pytest.mark.skipif(sys.platform != "win32", reason="requires Windows")
21 def test_enable_signals_win32(scalene_cleanup):
22 with patch.object(Scalene, "_Scalene__orig_signal") as mock_orig_signal:
23 with patch.object(Scalene, "cpu_signal_handler"):
24 with patch.object(Scalene, "windows_timer_loop"):
25 with patch.object(Scalene, "start_signal_queues"):
26 Scalene.enable_signals_win32()
27 mock_orig_signal.assert_called_once()
28 assert Scalene.timer_signals is True