|
|
0c4bba |
From 2c5dce5c027de2662d81944f1ba129d8a860b0a7 Mon Sep 17 00:00:00 2001
|
|
|
0c4bba |
From: Lumir Balhar <lbalhar@redhat.com>
|
|
|
0c4bba |
Date: Tue, 10 Jan 2023 08:34:25 +0100
|
|
|
0c4bba |
Subject: [PATCH] fix tests
|
|
|
0c4bba |
|
|
|
0c4bba |
---
|
|
|
0c4bba |
pyproject.toml | 8 --------
|
|
|
0c4bba |
src/tox/pytest.py | 16 +++-------------
|
|
|
0c4bba |
tests/test_provision.py | 18 ++----------------
|
|
|
0c4bba |
3 files changed, 5 insertions(+), 37 deletions(-)
|
|
|
0c4bba |
|
|
|
0c4bba |
diff --git a/pyproject.toml b/pyproject.toml
|
|
|
0c4bba |
index 50142c5..66f8b5a 100644
|
|
|
0c4bba |
--- a/pyproject.toml
|
|
|
0c4bba |
+++ b/pyproject.toml
|
|
|
0c4bba |
@@ -74,17 +74,12 @@ optional-dependencies.docs = [
|
|
|
0c4bba |
]
|
|
|
0c4bba |
optional-dependencies.testing = [
|
|
|
0c4bba |
"build[virtualenv]>=1.2.2",
|
|
|
0c4bba |
- "covdefaults>=2.3",
|
|
|
0c4bba |
- "detect-test-pollution>=1.2",
|
|
|
0c4bba |
- "devpi-process>=1.0.2",
|
|
|
0c4bba |
- "diff-cover>=9.2",
|
|
|
0c4bba |
"distlib>=0.3.8",
|
|
|
0c4bba |
"flaky>=3.8.1",
|
|
|
0c4bba |
"hatch-vcs>=0.4",
|
|
|
0c4bba |
"hatchling>=1.25",
|
|
|
0c4bba |
"psutil>=6",
|
|
|
0c4bba |
"pytest>=8.3.3",
|
|
|
0c4bba |
- "pytest-cov>=5",
|
|
|
0c4bba |
"pytest-mock>=3.14",
|
|
|
0c4bba |
"pytest-xdist>=3.6.1",
|
|
|
0c4bba |
"re-assert>=1.1",
|
|
|
0c4bba |
@@ -192,9 +187,6 @@ report.omit = [
|
|
|
0c4bba |
"tests/type_check/*",
|
|
|
0c4bba |
]
|
|
|
0c4bba |
run.parallel = true
|
|
|
0c4bba |
-run.plugins = [
|
|
|
0c4bba |
- "covdefaults",
|
|
|
0c4bba |
-]
|
|
|
0c4bba |
|
|
|
0c4bba |
[tool.towncrier]
|
|
|
0c4bba |
name = "tox"
|
|
|
0c4bba |
diff --git a/src/tox/pytest.py b/src/tox/pytest.py
|
|
|
0c4bba |
index 13072fd..80bf266 100644
|
|
|
0c4bba |
--- a/src/tox/pytest.py
|
|
|
0c4bba |
+++ b/src/tox/pytest.py
|
|
|
0c4bba |
@@ -17,7 +17,6 @@ from typing import TYPE_CHECKING, Any, Callable, Iterator, Protocol, Sequence, c
|
|
|
0c4bba |
|
|
|
0c4bba |
import pytest
|
|
|
0c4bba |
from _pytest.fixtures import SubRequest # noqa: PLC2701
|
|
|
0c4bba |
-from devpi_process import IndexServer
|
|
|
0c4bba |
from virtualenv.info import fs_supports_symlink
|
|
|
0c4bba |
|
|
|
0c4bba |
import tox.run
|
|
|
0c4bba |
@@ -280,9 +279,9 @@ class ToxProject:
|
|
|
0c4bba |
m.setattr(sys, "argv", [sys.executable, "-m", "tox", *list(args)])
|
|
|
0c4bba |
m.setenv("VIRTUALENV_SYMLINK_APP_DATA", "1")
|
|
|
0c4bba |
m.setenv("VIRTUALENV_SYMLINKS", "1")
|
|
|
0c4bba |
- m.setenv("VIRTUALENV_PIP", "embed")
|
|
|
0c4bba |
- m.setenv("VIRTUALENV_WHEEL", "embed")
|
|
|
0c4bba |
- m.setenv("VIRTUALENV_SETUPTOOLS", "embed")
|
|
|
0c4bba |
+ m.setenv("VIRTUALENV_PIP", "bundle")
|
|
|
0c4bba |
+ m.setenv("VIRTUALENV_WHEEL", "bundle")
|
|
|
0c4bba |
+ m.setenv("VIRTUALENV_SETUPTOOLS", "bundle")
|
|
|
0c4bba |
try:
|
|
|
0c4bba |
tox_run(args)
|
|
|
0c4bba |
except SystemExit as exception:
|
|
|
0c4bba |
@@ -475,15 +474,6 @@ def enable_pypi_server(monkeypatch: pytest.MonkeyPatch, url: str | None) -> None
|
|
|
0c4bba |
monkeypatch.setenv("PIP_TIMEOUT", str(2))
|
|
|
0c4bba |
|
|
|
0c4bba |
|
|
|
0c4bba |
-@pytest.fixture(scope="session")
|
|
|
0c4bba |
-def pypi_server(tmp_path_factory: pytest.TempPathFactory) -> Iterator[IndexServer]:
|
|
|
0c4bba |
- # takes around 2.5s
|
|
|
0c4bba |
- path = tmp_path_factory.mktemp("pypi")
|
|
|
0c4bba |
- with IndexServer(path) as server:
|
|
|
0c4bba |
- server.create_index("empty", "volatile=False")
|
|
|
0c4bba |
- yield server
|
|
|
0c4bba |
-
|
|
|
0c4bba |
-
|
|
|
0c4bba |
@pytest.fixture(scope="session")
|
|
|
0c4bba |
def _invalid_index_fake_port() -> int:
|
|
|
0c4bba |
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as socket_handler:
|
|
|
0c4bba |
diff --git a/tests/test_provision.py b/tests/test_provision.py
|
|
|
0c4bba |
index 5b2b652..7657c2e 100644
|
|
|
0c4bba |
--- a/tests/test_provision.py
|
|
|
0c4bba |
+++ b/tests/test_provision.py
|
|
|
0c4bba |
@@ -98,22 +98,9 @@ def tox_wheels(tox_wheel: Path, tmp_path_factory: TempPathFactory) -> list[Path]
|
|
|
0c4bba |
return result
|
|
|
0c4bba |
|
|
|
0c4bba |
|
|
|
0c4bba |
-@pytest.fixture(scope="session")
|
|
|
0c4bba |
-def pypi_index_self(pypi_server: IndexServer, tox_wheels: list[Path], demo_pkg_inline_wheel: Path) -> Index:
|
|
|
0c4bba |
- with elapsed("start devpi and create index"): # takes around 1s
|
|
|
0c4bba |
- self_index = pypi_server.create_index("self", "volatile=False")
|
|
|
0c4bba |
- with elapsed("upload tox and its wheels to devpi"): # takes around 3.2s on build
|
|
|
0c4bba |
- self_index.upload(*tox_wheels, demo_pkg_inline_wheel)
|
|
|
0c4bba |
- return self_index
|
|
|
0c4bba |
-
|
|
|
0c4bba |
-
|
|
|
0c4bba |
@pytest.fixture
|
|
|
0c4bba |
-def _pypi_index_self(pypi_index_self: Index, monkeypatch: MonkeyPatch) -> None:
|
|
|
0c4bba |
- pypi_index_self.use()
|
|
|
0c4bba |
- monkeypatch.setenv("PIP_INDEX_URL", pypi_index_self.url)
|
|
|
0c4bba |
- monkeypatch.setenv("PIP_RETRIES", str(2))
|
|
|
0c4bba |
- monkeypatch.setenv("PIP_TIMEOUT", str(5))
|
|
|
0c4bba |
-
|
|
|
0c4bba |
+def _pypi_index_self():
|
|
|
0c4bba |
+ pytest.skip("needs devpi-process")
|
|
|
0c4bba |
|
|
|
0c4bba |
def test_provision_requires_nok(tox_project: ToxProjectCreator) -> None:
|
|
|
0c4bba |
ini = "[tox]\nrequires = pkg-does-not-exist\n setuptools==1\nskipsdist=true\n"
|
|
|
0c4bba |
@@ -161,7 +148,6 @@ def test_provision_requires_ok(tox_project: ToxProjectCreator, tmp_path: Path) -
|
|
|
0c4bba |
|
|
|
0c4bba |
|
|
|
0c4bba |
@pytest.mark.integration
|
|
|
0c4bba |
-@pytest.mark.usefixtures("_pypi_index_self")
|
|
|
0c4bba |
def test_provision_platform_check(tox_project: ToxProjectCreator) -> None:
|
|
|
0c4bba |
ini = "[tox]\nrequires=demo-pkg-inline\n[testenv]\npackage=skip\n[testenv:.tox]\nplatform=wrong_platform"
|
|
|
0c4bba |
proj = tox_project({"tox.ini": ini})
|
|
|
0c4bba |
--
|
|
|
0c4bba |
2.46.2
|
|
|
0c4bba |
|