|
| 1 | +import os |
1 | 2 | import sys |
2 | 3 | import tomllib |
3 | 4 | from collections.abc import Mapping |
@@ -167,6 +168,78 @@ def test_empty_selector(monkeypatch: pytest.MonkeyPatch) -> None: |
167 | 168 | assert e.value.code == 3 |
168 | 169 |
|
169 | 170 |
|
| 171 | +@pytest.mark.usefixtures("platform", "intercepted_build_args") |
| 172 | +def test_cp313t_warning1( |
| 173 | + monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture[str] |
| 174 | +) -> None: |
| 175 | + monkeypatch.setenv("CIBW_ENABLE", "cpython-freethreading") |
| 176 | + |
| 177 | + main() |
| 178 | + |
| 179 | + _, err = capsys.readouterr() |
| 180 | + print(err) |
| 181 | + assert "'cpython-freethreading' enable is deprecated" in err |
| 182 | + |
| 183 | + |
| 184 | +@pytest.mark.usefixtures("platform", "intercepted_build_args") |
| 185 | +def test_cp313t_warning2( |
| 186 | + monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture[str], tmp_path: Path |
| 187 | +) -> None: |
| 188 | + local_path = tmp_path / "tmp_project" |
| 189 | + os.mkdir(local_path) # noqa:PTH102 Path.mkdir has been monkeypatched already |
| 190 | + local_path.joinpath("setup.py").touch() |
| 191 | + |
| 192 | + monkeypatch.setattr( |
| 193 | + sys, "argv", ["cibuildwheel", "--only", "cp313t-manylinux_x86_64", str(local_path)] |
| 194 | + ) |
| 195 | + monkeypatch.setenv("CIBW_ENABLE", "cpython-freethreading") |
| 196 | + |
| 197 | + main() |
| 198 | + |
| 199 | + _, err = capsys.readouterr() |
| 200 | + print(err) |
| 201 | + assert "'cpython-freethreading' enable is deprecated" in err |
| 202 | + |
| 203 | + |
| 204 | +@pytest.mark.usefixtures("platform", "intercepted_build_args") |
| 205 | +def test_cp313t_warning3( |
| 206 | + monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture[str], tmp_path: Path |
| 207 | +) -> None: |
| 208 | + local_path = tmp_path / "tmp_project" |
| 209 | + os.mkdir(local_path) # noqa:PTH102 Path.mkdir has been monkeypatched already |
| 210 | + local_path.joinpath("setup.py").touch() |
| 211 | + |
| 212 | + monkeypatch.setattr( |
| 213 | + sys, "argv", ["cibuildwheel", "--only", "cp313t-manylinux_x86_64", str(local_path)] |
| 214 | + ) |
| 215 | + |
| 216 | + main() |
| 217 | + |
| 218 | + _, err = capsys.readouterr() |
| 219 | + print(err) |
| 220 | + assert "'cpython-freethreading' enable is deprecated" in err |
| 221 | + |
| 222 | + |
| 223 | +@pytest.mark.usefixtures("platform", "intercepted_build_args") |
| 224 | +def test_cp313t_warning4( |
| 225 | + monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture[str], tmp_path: Path |
| 226 | +) -> None: |
| 227 | + local_path = tmp_path / "tmp_project" |
| 228 | + os.mkdir(local_path) # noqa:PTH102 Path.mkdir has been monkeypatched already |
| 229 | + local_path.joinpath("setup.py").touch() |
| 230 | + |
| 231 | + monkeypatch.setattr( |
| 232 | + sys, "argv", ["cibuildwheel", "--only", "cp313t-manylinux_x86_64", str(local_path)] |
| 233 | + ) |
| 234 | + monkeypatch.setenv("CIBW_ENABLE", "all") |
| 235 | + |
| 236 | + main() |
| 237 | + |
| 238 | + _, err = capsys.readouterr() |
| 239 | + print(err) |
| 240 | + assert "'cpython-freethreading' enable is deprecated" in err |
| 241 | + |
| 242 | + |
170 | 243 | @pytest.mark.parametrize( |
171 | 244 | ("architecture", "image", "full_image"), |
172 | 245 | [ |
@@ -579,6 +652,7 @@ def test_enable_all( |
579 | 652 | intercepted_build_args: "ArgsInterceptor", monkeypatch: pytest.MonkeyPatch |
580 | 653 | ) -> None: |
581 | 654 | monkeypatch.setattr(sys, "argv", [*sys.argv, "--enable", "all"]) |
| 655 | + monkeypatch.delenv("CIBW_ENABLE", raising=False) |
582 | 656 |
|
583 | 657 | main() |
584 | 658 |
|
|
0 commit comments