We do not have devpi_process available (yet) --- tox-4.23.2/pyproject.toml.orig +++ tox-4.23.2/pyproject.toml @@ -231,7 +231,6 @@ "build[virtualenv]>=1.2.2", "covdefaults>=2.3", "detect-test-pollution>=1.2", - "devpi-process>=1.0.2", "diff-cover>=9.2", "distlib>=0.3.8", "flaky>=3.8.1", --- tox-4.23.2/src/tox/pytest.py.orig +++ tox-4.23.2/src/tox/pytest.py @@ -17,7 +17,6 @@ import pytest from _pytest.fixtures import SubRequest # noqa: PLC2701 -from devpi_process import IndexServer from virtualenv.info import fs_supports_symlink import tox.run @@ -476,15 +475,6 @@ @pytest.fixture(scope="session") -def pypi_server(tmp_path_factory: pytest.TempPathFactory) -> Iterator[IndexServer]: - # takes around 2.5s - path = tmp_path_factory.mktemp("pypi") - with IndexServer(path) as server: - server.create_index("empty", "volatile=False") - yield server - - -@pytest.fixture(scope="session") def _invalid_index_fake_port() -> int: with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as socket_handler: socket_handler.bind(("", 0)) --- tox-4.23.2/tests/test_provision.py.orig +++ tox-4.23.2/tests/test_provision.py @@ -16,8 +16,6 @@ from packaging.requirements import Requirement if TYPE_CHECKING: - from devpi_process import Index, IndexServer - from tox.pytest import MonkeyPatch, TempPathFactory, ToxProjectCreator from importlib.metadata import Distribution @@ -98,23 +96,6 @@ return result -@pytest.fixture(scope="session") -def pypi_index_self(pypi_server: IndexServer, tox_wheels: list[Path], demo_pkg_inline_wheel: Path) -> Index: - with elapsed("start devpi and create index"): # takes around 1s - self_index = pypi_server.create_index("self", "volatile=False") - with elapsed("upload tox and its wheels to devpi"): # takes around 3.2s on build - self_index.upload(*tox_wheels, demo_pkg_inline_wheel) - return self_index - - -@pytest.fixture -def _pypi_index_self(pypi_index_self: Index, monkeypatch: MonkeyPatch) -> None: - pypi_index_self.use() - monkeypatch.setenv("PIP_INDEX_URL", pypi_index_self.url) - monkeypatch.setenv("PIP_RETRIES", str(2)) - monkeypatch.setenv("PIP_TIMEOUT", str(5)) - - def test_provision_requires_nok(tox_project: ToxProjectCreator) -> None: ini = "[tox]\nrequires = pkg-does-not-exist\n setuptools==1\nskipsdist=true\n" outcome = tox_project({"tox.ini": ini}).run("c", "-e", "py") @@ -128,96 +109,6 @@ @pytest.mark.integration -@pytest.mark.usefixtures("_pypi_index_self") -def test_provision_requires_ok(tox_project: ToxProjectCreator, tmp_path: Path) -> None: - proj = tox_project({"tox.ini": "[tox]\nrequires=demo-pkg-inline\n[testenv]\npackage=skip"}) - log = tmp_path / "out.log" - - # initial run - result_first = proj.run("r", "--result-json", str(log)) - result_first.assert_success() - prov_msg = ( - f"ROOT: will run in automatically provisioned tox, host {sys.executable} is missing" - f" [requires (has)]: demo-pkg-inline" - ) - assert prov_msg in result_first.out - - with log.open("rt") as file_handler: - log_report = json.load(file_handler) - assert "py" in log_report["testenvs"] - - # recreate without recreating the provisioned env - provision_env = result_first.env_conf(".tox")["env_dir"] - result_recreate_no_pr = proj.run("r", "--recreate", "--no-recreate-provision") - result_recreate_no_pr.assert_success() - assert prov_msg in result_recreate_no_pr.out - assert f"ROOT: remove tox env folder {provision_env}" not in result_recreate_no_pr.out, result_recreate_no_pr.out - - # recreate with recreating the provisioned env - result_recreate = proj.run("r", "--recreate") - result_recreate.assert_success() - assert prov_msg in result_recreate.out - assert f"ROOT: remove tox env folder {provision_env}" in result_recreate.out, result_recreate.out - - -@pytest.mark.integration -@pytest.mark.usefixtures("_pypi_index_self") -def test_provision_platform_check(tox_project: ToxProjectCreator) -> None: - ini = "[tox]\nrequires=demo-pkg-inline\n[testenv]\npackage=skip\n[testenv:.tox]\nplatform=wrong_platform" - proj = tox_project({"tox.ini": ini}) - - result = proj.run("r") - result.assert_failed(-2) - msg = f"cannot provision tox environment .tox because platform {sys.platform} does not match wrong_platform" - assert msg in result.out - - -def test_provision_no_recreate(tox_project: ToxProjectCreator) -> None: - ini = "[tox]\nrequires = p\nskipsdist=true\n" - result = tox_project({"tox.ini": ini}).run("c", "-e", "py", "--no-provision") - result.assert_failed() - assert f"provisioning explicitly disabled within {sys.executable}, but is missing [requires (has)]: p" in result.out - - -def test_provision_no_recreate_json(tox_project: ToxProjectCreator) -> None: - ini = "[tox]\nrequires = p\nskipsdist=true\n" - project = tox_project({"tox.ini": ini}) - result = project.run("c", "-e", "py", "--no-provision", "out.json") - result.assert_failed() - msg = ( - f"provisioning explicitly disabled within {sys.executable}, " - f"but is missing [requires (has)]: p and wrote to out.json" - ) - assert msg in result.out - with (project.path / "out.json").open() as file_handler: - requires = json.load(file_handler) - assert requires == {"minversion": None, "requires": ["p", "tox"]} - - -@pytest.mark.integration -@pytest.mark.usefixtures("_pypi_index_self") -@pytest.mark.parametrize("plugin_testenv", ["testenv", "testenv:a"]) -def test_provision_plugin_runner(tox_project: ToxProjectCreator, tmp_path: Path, plugin_testenv: str) -> None: - """Ensure that testenv runner doesn't affect the provision env.""" - log = tmp_path / "out.log" - proj = tox_project( - {"tox.ini": f"[tox]\nrequires=demo-pkg-inline\nlabels=l=py\n[{plugin_testenv}]\nrunner=example"}, - ) - prov_msg = ( - f"ROOT: will run in automatically provisioned tox, host {sys.executable} is missing" - f" [requires (has)]: demo-pkg-inline" - ) - - result_env = proj.run("r", "-e", "py", "--result-json", str(log)) - result_env.assert_success() - assert prov_msg in result_env.out - - result_label = proj.run("r", "-m", "l", "--result-json", str(log)) - result_label.assert_success() - assert prov_msg in result_label.out - - -@pytest.mark.integration def test_provision_plugin_runner_in_provision(tox_project: ToxProjectCreator, tmp_path: Path) -> None: """Ensure that provision environment can be explicitly configured.""" log = tmp_path / "out.log" @@ -226,17 +117,6 @@ proj.run("r", "-e", "py", "--result-json", str(log)) -@pytest.mark.integration -@pytest.mark.usefixtures("_pypi_index_self") -@pytest.mark.parametrize("relative_path", [True, False], ids=["relative", "absolute"]) -def test_provision_conf_file(tox_project: ToxProjectCreator, tmp_path: Path, relative_path: bool) -> None: - ini = "[tox]\nrequires = demo-pkg-inline\nskipsdist=true\n" - project = tox_project({"tox.ini": ini}, prj_path=tmp_path / "sub") - conf_path = str(Path(project.path.name) / "tox.ini") if relative_path else str(project.path / "tox.ini") - result = project.run("c", "--conf", conf_path, "-e", "py", from_cwd=tmp_path) - result.assert_success() - - @pytest.mark.parametrize("subcommand", ["r", "p", "de", "l", "d", "c", "q", "e", "le"]) def test_provision_default_arguments_exists(tox_project: ToxProjectCreator, subcommand: str) -> None: ini = r"""