| 1 |
|
| 2 |
|
| 3 |
|
| 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 |
|
| 13 |
original_environ = os.environ.copy() |
| 14 |
yield |
| 15 |
|
| 16 |
os.environ.clear() |
| 17 |
os.environ.update(original_environ) |
| 18 |
|
| 19 |
|
| 20 |
def test_in_windows_terminal_true(clean_environment): |
| 21 |
|
| 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 |
|
| 28 |
if "WT_PROFILE_ID" in os.environ: |
| 29 |
del os.environ["WT_PROFILE_ID"] |
| 30 |
assert _in_windows_terminal() is False |