Debian Codegraph @

tests/test_coverup_92.py

raw symbols SCIP
1 # file scalene/scalene_profiler.py:118-121
2 # lines [118, 119, 120, 121]
3 # branches []
4
5 import sys
6 from unittest.mock import patch
7 import pytest
8
9 # Assuming the correct import based on the error message
10 from scalene import scalene_profiler
11
12
13 def test_require_python():
14 # Save the original version info
15 original_version_info = sys.version_info
16
17 # Test with a version that should pass
18 with patch.object(sys, "version_info", (3, 8)):
19 scalene_profiler.require_python((3, 6)) # Should not raise an assertion error
20
21 # Test with a version that should fail and raise an assertion error
22 with patch.object(sys, "version_info", (3, 5)), pytest.raises(AssertionError):
23 scalene_profiler.require_python((3, 6))
24
25 # Clean up by restoring the original version info
26 sys.version_info = original_version_info
27
28
29 # Ensure that the test does not affect other tests by checking the version after the test
30 def test_version_info_unchanged():
31 assert sys.version_info >= (
32 3,
33 6,
34 ), "sys.version_info should be unchanged after tests"