We do not have devpi_process available (yet) --- tox-4.67.4/pyproject.toml.orig +++ tox-4.67.4/pyproject.toml @@ -88,7 +88,6 @@ "covdefaults>=2.3", "coverage>=7.13.4", "detect-test-pollution>=1.2", - "devpi-process>=1.1.1", "diff-cover>=10.2", "distlib>=0.4", "docutils>=0.21", --- tox-4.67.4/src/tox/pytest.py.orig +++ tox-4.67.4/src/tox/pytest.py @@ -17,7 +17,6 @@ import pytest from _pytest.fixtures import SubRequest # ruff:ignore[import-private-name] -from devpi_process import IndexServer from virtualenv.info import fs_supports_symlink import tox.run @@ -473,15 +472,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.67.4/tests/test_provision.py.orig +++ tox-4.67.4/tests/test_provision.py @@ -20,7 +20,6 @@ from collections.abc import Callable, Generator, Sequence from build import DistributionType - from devpi_process import Index, IndexServer from tox.execute.request import ExecuteRequest from tox.pytest import MonkeyPatch, TempPathFactory, ToxProjectCreator @@ -106,39 +105,6 @@ return result -@pytest.fixture(scope="session") -def local_pypi_indexes( - pypi_server: IndexServer, tox_wheels: list[Path], demo_pkg_inline_wheel: Path -) -> tuple[Index, Index]: - with elapsed("start devpi and create indexes"): # takes around 1s - pypi_server.create_index("mirror", "type=mirror", "mirror_url=https://pypi.org/simple/") - mirrored_index = pypi_server.create_index("magic", f"bases={pypi_server.user}/mirror") - self_index = pypi_server.create_index("self", "volatile=False") - with elapsed("upload tox and its wheels to devpi"): # takes around 3.2s on build - mirrored_index.upload(*tox_wheels, demo_pkg_inline_wheel) - self_index.upload(*tox_wheels, demo_pkg_inline_wheel) - return mirrored_index, self_index - - -def _use_pypi_index(pypi_index: Index, monkeypatch: MonkeyPatch) -> None: - pypi_index.use() - monkeypatch.setenv("PIP_INDEX_URL", pypi_index.url) - monkeypatch.setenv("PIP_RETRIES", str(2)) - monkeypatch.setenv("PIP_TIMEOUT", str(5)) - - -@pytest.fixture -def _pypi_index_mirrored(local_pypi_indexes: tuple[Index, Index], monkeypatch: MonkeyPatch) -> None: - pypi_index_mirrored, _ = local_pypi_indexes - _use_pypi_index(pypi_index_mirrored, monkeypatch) - - -@pytest.fixture -def _pypi_index_self(local_pypi_indexes: tuple[Index, Index], monkeypatch: MonkeyPatch) -> None: - _, pypi_index_self = local_pypi_indexes - _use_pypi_index(pypi_index_self, monkeypatch) - - 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") @@ -228,52 +194,6 @@ assert f"future tox ran {subcommand}" in outcome.out -@pytest.mark.integration -@pytest.mark.usefixtures("_pypi_index_self") -@pytest.mark.timeout(120) -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), "--no-list-dependencies") - 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", "--no-list-dependencies") - 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", "--no-list-dependencies") - 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_invalid_platform_regex(tox_project: ToxProjectCreator) -> None: toml = """ requires = ["p"] @@ -336,29 +256,6 @@ @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" @@ -367,17 +264,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() - - def test_provision_acquires_file_lock(tox_project: ToxProjectCreator) -> None: lock_held_during_provision: dict[str, bool] = {} @@ -408,28 +294,6 @@ assert "unrecognized arguments: --some-unknown-flag" in result.out -@pytest.mark.integration -@pytest.mark.usefixtures("_pypi_index_self") -def test_provision_plugin_cli_options(tox_project: ToxProjectCreator, tmp_path: Path) -> None: - """Tox should provision before rejecting CLI options from not-yet-installed plugins.""" - log = tmp_path / "out.log" - proj = tox_project({ - "tox.toml": """ - requires = ["demo-pkg-inline"] - [env_run_base] - package = "skip" - """, - }) - prov_msg = ( - f"ROOT: will run in automatically provisioned tox, host {sys.executable} is missing" - f" [requires (has)]: demo-pkg-inline" - ) - - result = proj.run("r", "-e", "py", "--demo-plugin", "--result-json", str(log)) - result.assert_success() - assert prov_msg in result.out - - @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""" @@ -446,37 +310,6 @@ assert hasattr(outcome.state.conf.options, argument) -@pytest.mark.integration -@pytest.mark.usefixtures("_pypi_index_mirrored") -@pytest.mark.timeout(120) -def test_provision_install_pkg_pep517( - tmp_path_factory: TempPathFactory, - tox_project: ToxProjectCreator, - pkg_builder: Callable[[Path, Path, Sequence[DistributionType], bool], Path], -) -> None: - example = tmp_path_factory.mktemp("example") - skeleton = """ - [build-system] - requires = ["setuptools"] - build-backend = "setuptools.build_meta" - [project] - name = "skeleton" - version = "0.1.1337" - """ - (example / "pyproject.toml").write_text(skeleton) - wheel = pkg_builder(example / "dist", example, ["wheel"], False) - - tox_ini = r""" - [tox] - requires = demo-pkg-inline - [testenv] - commands = python -c "print(42)" - """ - project = tox_project({"tox.ini": tox_ini}, base=example) - result = project.run("r", "-e", "py", "--installpkg", str(wheel), "--notest", "--no-list-dependencies") - result.assert_success() - - def test_provision_colored_passed_to_subprocess(tox_project: ToxProjectCreator) -> None: captured_cmd = None