Debian Codegraph @

tests/test_coverup_78.py

raw symbols SCIP
1 # file scalene/scalene_profiler.py:1843-1854
2 # lines [1843, 1844, 1846, 1848, 1850, 1851, 1852, 1853]
3 # branches []
4
5 import pytest
6 from unittest.mock import patch
7 from scalene.scalene_profiler import Scalene
8
9
10 @pytest.fixture
11 def scalene_cleanup():
12 # Fixture to clean up any state after the test
13 yield
14 Scalene._Scalene__files_to_profile.clear()
15
16
17 def test_register_files_to_profile(scalene_cleanup):
18 # Set up the necessary attributes in Scalene
19 Scalene._Scalene__args = type("", (), {})()
20 Scalene._Scalene__args.profile_only = "test1.py,test2.py"
21 Scalene._Scalene__args.profile_all = False
22 Scalene._Scalene__files_to_profile = set(["test3.py"])
23 Scalene._Scalene__program_path = "."
24
25 with patch(
26 "scalene.pywhere.register_files_to_profile"
27 ) as mock_register_files_to_profile:
28 # Call the method under test
29 Scalene.register_files_to_profile()
30
31 # Check that pywhere.register_files_to_profile was called with the correct arguments
32 mock_register_files_to_profile.assert_called_once_with(
33 ["test3.py", "test1.py", "test2.py"], ".", False
34 )