MCPcopy
hub / github.com/tox-dev/tox / disable_pip_pypi_access

Function disable_pip_pypi_access

src/tox/pytest.py:503–510  ·  view source on GitHub ↗

Set a fake pip index url, tests that want to use a pypi server should create and overwrite this.

(_invalid_index_fake_port: int, monkeypatch: pytest.MonkeyPatch)

Source from the content-addressed store, hash-verified

501
502@pytest.fixture(autouse=True) # noqa: RUF076
503def disable_pip_pypi_access(_invalid_index_fake_port: int, monkeypatch: pytest.MonkeyPatch) -> tuple[str, str | None]:
504 """Set a fake pip index url, tests that want to use a pypi server should create and overwrite this."""
505 previous_url = os.environ.get("PIP_INDEX_URL")
506 new_url = f"http://localhost:{_invalid_index_fake_port}/bad-pypi-server"
507 monkeypatch.setenv("PIP_INDEX_URL", new_url)
508 monkeypatch.setenv("PIP_RETRIES", str(0))
509 monkeypatch.setenv("PIP_TIMEOUT", str(0.001))
510 return new_url, previous_url
511
512
513@pytest.fixture(name="enable_pip_pypi_access")

Callers

nothing calls this directly

Calls 1

getMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…