diff options
author | Bernát Gábor <gaborjbernat@gmail.com> | 2022-12-02 23:24:12 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-02 23:24:12 -0800 |
commit | 6f4cf48185f5a4c280cecabf74fe58ca5f56d44f (patch) | |
tree | ca5c7a99148b6d49b0b1577596ada977772c3241 /tests | |
parent | d9de29da802edaa8b7291ca27d59b0ba0c1d2c26 (diff) | |
download | tox-git-6f4cf48185f5a4c280cecabf74fe58ca5f56d44f.tar.gz |
Use devpi-process instead rolling our own (#2582)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_provision.py | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/tests/test_provision.py b/tests/test_provision.py index f22d1279..2427b0ec 100644 --- a/tests/test_provision.py +++ b/tests/test_provision.py @@ -11,12 +11,13 @@ from typing import Callable, Iterator from zipfile import ZipFile import pytest +from devpi_process import Index, IndexServer from filelock import FileLock from packaging.requirements import Requirement from packaging.version import Version from tox import __version__ -from tox.pytest import Index, IndexServer, MonkeyPatch, TempPathFactory, ToxProjectCreator +from tox.pytest import MonkeyPatch, TempPathFactory, ToxProjectCreator if sys.version_info >= (3, 8): # pragma: no cover (py38+) from importlib.metadata import Distribution @@ -100,10 +101,18 @@ def pypi_index_self(pypi_server: IndexServer, tox_wheels: list[Path], demo_pkg_i 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]) + 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") @@ -117,13 +126,8 @@ def test_provision_requires_nok(tox_project: ToxProjectCreator) -> None: @pytest.mark.integration() -def test_provision_requires_ok( - tox_project: ToxProjectCreator, - pypi_index_self: Index, - monkeypatch: MonkeyPatch, - tmp_path: Path, -) -> None: - pypi_index_self.use(monkeypatch) +@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" @@ -155,12 +159,8 @@ def test_provision_requires_ok( @pytest.mark.integration() -def test_provision_platform_check( - tox_project: ToxProjectCreator, - pypi_index_self: Index, - monkeypatch: MonkeyPatch, -) -> None: - pypi_index_self.use(monkeypatch) +@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}) |