INNER CODE UNIT · Python

test_package_windows

logandk/serverless-wsgi · requirements_test.py:199

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"],),
    )


def test_pip_error(mock_system, mock_virtualenv, monkeypatch):
    monkeypatch.setattr(subprocess, "Popen", lambda *args, **kwargs: PopenStub(1))

    with pytest.raises(SystemExit):
        requirements.package(["/path1/requirements.txt"], "/tmp")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…