Debian Codegraph @

tests/test_coverup_47.py

raw symbols SCIP
1 # file scalene/sparkline.py:56-61
2 # lines [61]
3 # branches []
4
5 import os
6 import pytest
7 from scalene.sparkline import _in_windows_terminal
8
9
10 @pytest.fixture
11 def clean_environment():
12 # Backup the original environment variables
13 original_environ = os.environ.copy()
14 yield
15 # Restore the original environment after the test
16 os.environ.clear()
17 os.environ.update(original_environ)
18
19
20 def test_in_windows_terminal_true(clean_environment):
21 # Set the environment variable to simulate Windows Terminal
22 os.environ["WT_PROFILE_ID"] = "some_value"
23 assert _in_windows_terminal() is True
24
25
26 def test_in_windows_terminal_false(clean_environment):
27 # Ensure the environment variable is not set
28 if "WT_PROFILE_ID" in os.environ:
29 del os.environ["WT_PROFILE_ID"]
30 assert _in_windows_terminal() is False