INNER CODE UNIT · Python
test_package_missing_python_dir
logandk/serverless-wsgi · requirements_test.py:192
def test_package_missing_python_dir(mock_system, mock_virtualenv, monkeypatch):
monkeypatch.setattr(os, "listdir", lambda f: [])
with pytest.raises(SystemExit):
requirements.package(["/path1/requirements.txt"], "/tmp")
def test_package_windows(mock_system, mock_virtualenv, monkeypatch):
monkeypatch.setattr(platform, "system", lambda: "Windows")
requirements.package(["/path1/requirements.txt"], "/tmp")
pip_calls = [c for c in mock_system if c[0] == "subprocess.Popen"]
assert pip_calls[0] == (
"subprocess.Popen",
(["/tmp/.venv/Scripts/pip.exe", "install", "-r", "/path1/requirements.txt"],),
)