We do not have devpi_process available (yet) --- tox-4.31.0/pyproject.toml.orig +++ tox-4.31.0/pyproject.toml @@ -79,7 +79,6 @@ "covdefaults>=2.3", "coverage>=7.10.7", "detect-test-pollution>=1.2", - "devpi-process>=1.0.2", "diff-cover>=9.7.1", "distlib>=0.4", "flaky>=3.8.1", --- tox-4.31.0/src/tox/pytest.py.orig +++ tox-4.31.0/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 @@ -480,15 +479,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.31.0/tests/test_provision.py.orig +++ tox-4.31.0/tests/test_provision.py @@ -19,7 +19,6 @@ from collections.abc import Callable, Iterator, Sequence from build import DistributionType - from devpi_process import Index, IndexServer from tox.pytest import MonkeyPatch, TempPathFactory, ToxProjectCreator @@ -104,39 +103,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") @@ -150,96 +116,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" @@ -248,17 +124,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""" @@ -273,33 +138,3 @@ outcome = project.run(subcommand) for argument in ["result_json", "hash_seed", "discover", "list_dependencies"]: assert hasattr(outcome.state.conf.options, argument) - - -@pytest.mark.integration -@pytest.mark.usefixtures("_pypi_index_mirrored") -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) - sdist = pkg_builder(example / "dist", example, ["sdist"], 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(sdist), "--notest") - result.assert_success()