Accepting request 971975 from devel:languages:python:pytest

OBS-URL: https://build.opensuse.org/request/show/971975
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pytest-server-fixtures?expand=0&rev=7
This commit is contained in:
2022-04-22 19:54:39 +00:00
committed by Git OBS Bridge
3 changed files with 89 additions and 3 deletions

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Apr 21 20:21:33 UTC 2022 - Ben Greiner <code@bnavigator.de>
- Add remove-mock.patch because mock WAS required and is not pulled
in anymore by something else -- gh#man-group/pytest-plugins#171
-------------------------------------------------------------------
Mon Mar 21 04:29:05 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>

View File

@@ -17,16 +17,19 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%bcond_without python2
Name: python-pytest-server-fixtures
Version: 1.7.0
Release: 0
Summary: Extensible server fixures for py.test
Summary: Extensible server fixtures for pytest
License: MIT
Group: Development/Languages/Python
URL: https://github.com/man-group/pytest-plugins
Source: https://files.pythonhosted.org/packages/source/p/pytest-server-fixtures/pytest-server-fixtures-%{version}.tar.gz
# PATCH-FIX-UPSTREAM pytest-plugins-pr186-fix-psycopg29.patch -- gh#man-group/pytest-plugins#186
Patch0: https://github.com/man-group/pytest-plugins/pull/186.patch#/pytest-plugins-pr186-fix-psycopg29.patch
# PATCH-FEATURE-UPSTREAM remove-mock.patch -- gh#man-group#pytest-plugins#171
Patch1: remove-mock.patch
BuildRequires: %{python_module setuptools-git}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
@@ -75,6 +78,9 @@ BuildRequires: %{python_module requests}
BuildRequires: %{python_module rethinkdb}
BuildRequires: %{python_module retry}
BuildRequires: %{python_module six}
%if %{with python2}
BuildRequires: python2-mock
%endif
BuildRequires: apache2
BuildRequires: lsof
BuildRequires: net-tools-deprecated
@@ -87,7 +93,7 @@ BuildRequires: xorg-x11-server
%python_subpackages
%description
Extensible server fixures for py.test.
Extensible server fixtures for pytest
%prep
%autosetup -p2 -n pytest-server-fixtures-%{version}
@@ -120,6 +126,7 @@ export SERVER_FIXTURES_REDIS=%{_sbindir}/redis-server
%files %{python_files}
%doc CHANGES.md README.md
%license LICENSE
%{python_sitelib}/*
%{python_sitelib}/pytest_server_fixtures
%{python_sitelib}/pytest_server_fixtures-%{version}*-info
%changelog

73
remove-mock.patch Normal file
View File

@@ -0,0 +1,73 @@
Index: a/pytest-server-fixtures-1.7.0/tests/integration/test_xvfb_server.py
===================================================================
--- a/pytest-server-fixtures-1.7.0/tests/integration/test_xvfb_server.py
+++ b/pytest-server-fixtures-1.7.0/tests/integration/test_xvfb_server.py
@@ -4,7 +4,11 @@ import time
from itertools import chain, repeat
-from mock import patch
+try:
+ from unittest.mock import patch
+except ImportError:
+ from mock import patch
+
import pytest
from pytest import raises
Index: a/pytest-server-fixtures-1.7.0/tests/unit/serverclass/test_docker_unit.py
===================================================================
--- a/pytest-server-fixtures-1.7.0/tests/unit/serverclass/test_docker_unit.py
+++ b/pytest-server-fixtures-1.7.0/tests/unit/serverclass/test_docker_unit.py
@@ -1,4 +1,8 @@
-from mock import sentinel, patch, Mock
+try:
+ from unittest.mock import sentinel, patch, Mock
+except ImportError:
+ from mock import sentinel, patch, Mock
+
from pytest_server_fixtures.serverclass.docker import DockerServer
Index: a/pytest-server-fixtures-1.7.0/tests/unit/serverclass/test_thread_unit.py
===================================================================
--- a/pytest-server-fixtures-1.7.0/tests/unit/serverclass/test_thread_unit.py
+++ b/pytest-server-fixtures-1.7.0/tests/unit/serverclass/test_thread_unit.py
@@ -1,4 +1,8 @@
-from mock import sentinel, patch, Mock
+try:
+ from unittest.mock import sentinel, patch, Mock
+except ImportError:
+ from mock import sentinel, patch, Mock
+
from pytest_server_fixtures import CONFIG
from pytest_server_fixtures.serverclass.thread import ThreadServer
Index: a/pytest-server-fixtures-1.7.0/tests/unit/test_server_unit.py
===================================================================
--- a/pytest-server-fixtures-1.7.0/tests/unit/test_server_unit.py
+++ b/pytest-server-fixtures-1.7.0/tests/unit/test_server_unit.py
@@ -1,4 +1,8 @@
-from mock import create_autospec, sentinel, call, patch, Mock
+try:
+ from unittest.mock import create_autospec, sentinel, call, patch, Mock
+except ImportError:
+ from mock import create_autospec, sentinel, call, patch, Mock
+
from pytest_server_fixtures.base import TestServer as _TestServer # So that pytest doesnt think this is a test case
Index: pytest-server-fixtures-1.7.0/tests/unit/test_server_v2_unit.py
===================================================================
--- a/pytest-server-fixtures-1.7.0/tests/unit/test_server_v2_unit.py
+++ b/pytest-server-fixtures-1.7.0/tests/unit/test_server_v2_unit.py
@@ -1,4 +1,8 @@
-from mock import create_autospec, sentinel, call, patch, Mock
+try:
+ from unittest.mock import create_autospec, sentinel, call, patch, Mock
+except ImportError:
+ from mock import create_autospec, sentinel, call, patch, Mock
+
from pytest_server_fixtures.base2 import TestServerV2 as _TestServerV2 # TODO: why as _TestServerV2?