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)
| 501 | |
| 502 | @pytest.fixture(autouse=True) # noqa: RUF076 |
| 503 | def 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") |
nothing calls this directly
no test coverage detected
searching dependent graphs…