Andreas Wacknitz
2024-03-24 3df02058fb3d48a999bbc8d5d56c2910fbc249a4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
We do not have devpi_process available (yet)
 
--- tox-4.14.2/pyproject.toml.orig
+++ tox-4.14.2/pyproject.toml
@@ -74,7 +74,6 @@
   "build[virtualenv]>=1.0.3",
   "covdefaults>=2.3",
   "detect-test-pollution>=1.2",
-  "devpi-process>=1",
   "diff-cover>=8.0.2",
   "distlib>=0.3.8",
   "flaky>=3.7",
--- tox-4.14.2/src/tox/pytest.py.orig
+++ tox-4.14.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
@@ -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:  # noqa: PT005
     with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as socket_handler:
         socket_handler.bind(("", 0))
--- tox-4.14.2/tests/test_provision.py.orig
+++ tox-4.14.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
@@ -92,23 +90,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")
@@ -122,96 +103,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"
@@ -220,17 +111,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"""
--- tox-4.14.2/PKG-INFO.orig
+++ tox-4.14.2/PKG-INFO
@@ -54,7 +54,6 @@
 Requires-Dist: build[virtualenv]>=1.0.3; extra == 'testing'
 Requires-Dist: covdefaults>=2.3; extra == 'testing'
 Requires-Dist: detect-test-pollution>=1.2; extra == 'testing'
-Requires-Dist: devpi-process>=1; extra == 'testing'
 Requires-Dist: diff-cover>=8.0.2; extra == 'testing'
 Requires-Dist: distlib>=0.3.8; extra == 'testing'
 Requires-Dist: flaky>=3.7; extra == 'testing'