Skip to content

Commit 990e456

Browse files
committed
Add tests for internal venv activation checks
1 parent 2396484 commit 990e456

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/test_venv_internals.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
import subprocess
2+
from pathlib import Path
23

34
import pytest
45

56
from tests.helpers import run_command
67

78

9+
@pytest.mark.order(after="test_venv_deactivate.py::test_venv_deactivate")
10+
def test_check_venv_activated_no_env(monkeypatch: pytest.MonkeyPatch, tmp_path: Path):
11+
with pytest.raises(subprocess.CalledProcessError), monkeypatch.context() as m:
12+
m.delenv("VIRTUAL_ENV", raising=False)
13+
run_command(["venv deactivate", "venv::_check_venv_activated"], cwd=tmp_path, activated=False)
14+
15+
16+
@pytest.mark.order(after="test_venv_activate.py::test_venv_activate")
17+
def test_check_venv_activated_yes_env(tmp_path: Path):
18+
run_command("venv::_check_venv_activated", cwd=tmp_path, activated=True)
19+
20+
821
@pytest.mark.order("first")
922
@pytest.mark.parametrize(
1023
["filename", "expected"],

0 commit comments

Comments
 (0)