SHA256
1
0
forked from pool/python-tox

- Add mark-network-tests.patch to skip test which require network

access

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-tox?expand=0&rev=97
This commit is contained in:
Matej Cepl 2023-05-10 20:05:27 +00:00 committed by Git OBS Bridge
parent 0fbeef6ce6
commit 988f896c70
5 changed files with 91 additions and 8 deletions

27
mark-network-tests.patch Normal file
View File

@ -0,0 +1,27 @@
---
pyproject.toml | 3 +++
tests/tox_env/python/virtual_env/package/test_package_cmd_builder.py | 1 +
2 files changed, 4 insertions(+)
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -162,6 +162,9 @@ ignore = [
[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "--tb=auto -ra --showlocals --no-success-flaky-report"
+markers = [
+ "network: tests requiring network connection",
+]
[tool.towncrier]
name = "tox"
--- a/tests/tox_env/python/virtual_env/package/test_package_cmd_builder.py
+++ b/tests/tox_env/python/virtual_env/package/test_package_cmd_builder.py
@@ -74,6 +74,7 @@ def test_install_pkg_via(tox_project: To
@pytest.mark.usefixtures("enable_pip_pypi_access")
+@pytest.mark.network
def test_build_wheel_external(tox_project: ToxProjectCreator, demo_pkg_inline: Path) -> None:
ini = """
[testenv]

View File

@ -0,0 +1,42 @@
---
src/tox/pytest.py | 6 +++++-
tests/test_provision.py | 6 +++++-
2 files changed, 10 insertions(+), 2 deletions(-)
--- a/src/tox/pytest.py
+++ b/src/tox/pytest.py
@@ -26,7 +26,10 @@ from _pytest.logging import LogCaptureFi
from _pytest.monkeypatch import MonkeyPatch
from _pytest.python import Function
from _pytest.tmpdir import TempPathFactory
-from devpi_process import IndexServer
+try:
+ from devpi_process import IndexServer
+except ImportError:
+ IndexServer = None
from pytest_mock import MockerFixture
from virtualenv.info import fs_supports_symlink
@@ -473,6 +476,7 @@ def enable_pypi_server(monkeypatch: Monk
@pytest.fixture(scope="session")
+@pytest.mark.skipif(IndexServer is None, reason="requires devpi_process")
def pypi_server(tmp_path_factory: TempPathFactory) -> Iterator[IndexServer]:
# takes around 2.5s
path = tmp_path_factory.mktemp("pypi")
--- a/tests/test_provision.py
+++ b/tests/test_provision.py
@@ -12,7 +12,11 @@ from unittest import mock
from zipfile import ZipFile
import pytest
-from devpi_process import Index, IndexServer
+try:
+ from devpi_process import Index, IndexServer
+except ImportError:
+ Index = None
+ IndexServer = None
from filelock import FileLock
from packaging.requirements import Requirement

View File

@ -4,6 +4,8 @@ Fri May 5 14:30:53 UTC 2023 - Matej Cepl <mcepl@suse.com>
- Update to 4.5.1:
The amount of changes is so huge, that user is kindly referred
to the packaged changelog.
- Add mark-network-tests.patch to skip test which require network
access
-------------------------------------------------------------------
Fri Apr 21 12:37:47 UTC 2023 - Dirk Müller <dmueller@suse.com>

View File

@ -23,12 +23,21 @@ Release: 0
Summary: Virtualenv-based automation of test activities
License: MIT
URL: https://github.com/tox-dev/tox
Source: https://github.com/tox-dev/tox/archive/refs/tags/%{version}.tar.gz#/tox-%{version}.tar.gz
# Source: https://github.com/tox-dev/tox/archive/refs/tags/%%{version}.tar.gz#/tox-%%{version}.tar.gz
Source: https://files.pythonhosted.org/packages/source/t/tox/tox-%{version}.tar.gz
# PATCH-FIX-OPENSUSE optional_devpi_process.patch bsc#[0-9]+ mcepl@suse.com
# Make use devpi_process optional
Patch0: optional_devpi_process.patch
# PATCH-FEATURE-UPSTREAM mark-network-tests.patch bsc#[0-9]+ mcepl@suse.com
# to skip test which require network access
Patch1: mark-network-tests.patch
BuildRequires: %{python_module build >= 0.10.0}
BuildRequires: %{python_module cachetools >= 5.3}
BuildRequires: %{python_module chardet >= 5.1}
BuildRequires: %{python_module colorama >= 0.4.6}
BuildRequires: %{python_module filelock >= 3.11.0}
BuildRequires: %{python_module hatch >= 0.3}
BuildRequires: %{python_module hatch_vcs}
BuildRequires: %{python_module hatchling >= 1.14}
BuildRequires: %{python_module packaging >= 23.1}
BuildRequires: %{python_module pip}
@ -38,9 +47,11 @@ BuildRequires: %{python_module poetry-core}
BuildRequires: %{python_module py >= 1.4.17}
BuildRequires: %{python_module pyproject-api >= 1.5.1}
BuildRequires: %{python_module pytoml >= 0.1}
BuildRequires: %{python_module re-assert}
BuildRequires: %{python_module setuptools >= 41.0.1}
BuildRequires: %{python_module setuptools_scm >= 2.0.0}
BuildRequires: %{python_module six >= 1.14.0}
BuildRequires: %{python_module time-machine}
BuildRequires: %{python_module toml >= 0.9.4}
BuildRequires: %{python_module tomli >= 2.0.1}
BuildRequires: %{python_module virtualenv >= 20.21.0}
@ -51,6 +62,7 @@ BuildRequires: unzip
BuildRequires: (python3-importlib-metadata >= 0.12 if python3-base < 3.8)
BuildRequires: (python36-importlib-metadata >= 0.12 if python36-base)
Requires: python-backports.entry_points_selectable >= 1.0.4
Requires: python-build >= 0.10.0
Requires: python-filelock >= 3.0.0
Requires: python-packaging >= 14
Requires: python-pip
@ -96,7 +108,7 @@ use for:
CI and shell-based testing.
%prep
%setup -q -n tox-%{version}
%autosetup -p1 -n tox-%{version}
%build
export LANG=en_US.UTF8
@ -106,7 +118,6 @@ export LANG=en_US.UTF8
export LANG=en_US.UTF8
%pyproject_install
%python_clone -a %{buildroot}%{_bindir}/tox
%python_clone -a %{buildroot}%{_bindir}/tox-quickstart
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
@ -122,6 +133,8 @@ donttest+=" or test_different_config_cwd"
donttest+=" or test_toxuone_env"
donttest+=" or test_isolated_build_backend_missing_hook"
donttest+=" or test_parallel_live or (test_parallel and not test_parallel_)"
# gh#tox-dev/tox#3011
donttest+=" or test_replace_env_var_circular_flip_flop"
%{python_expand # tests expect an active virtualenv with a clean python name as sys.executable
virtualenv-%{$python_bin_suffix} --system-site-packages testenv-%{$python_bin_suffix}
@ -132,16 +145,15 @@ deactivate
}
%post
%python_install_alternative tox tox-quickstart
%python_install_alternative tox
%postun
%python_uninstall_alternative tox
%files %{python_files}
%license LICENSE
%doc README.md docs/changelog.rst CONTRIBUTORS CONTRIBUTING.rst
%doc README.md
%python_alternative %{_bindir}/tox
%python_alternative %{_bindir}/tox-quickstart
%{python_sitelib}/tox-%{version}*-info
%{python_sitelib}/tox

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6bf37c10479bf1335cfc70919a6030e0bc145f0029bcc6da505b38c92e36fd94
size 306426
oid sha256:5a2eac5fb816779dfdf5cb00fecbc27eb0524e4626626bb1de84747b24cacc56
size 170137