!1 modify patch

Merge pull request !1 from ultra_planet/new
This commit is contained in:
openeuler-ci-bot 2020-01-11 09:25:05 +08:00 committed by Gitee
commit a26ad068cd
3 changed files with 135 additions and 39 deletions

View File

@ -1,37 +0,0 @@
From 989e13e0514a97cd01234233dd85ebbd2805a3bb Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Wed, 9 May 2018 15:50:50 -0700
Subject: [PATCH] Skip tests that use 'xprocess' fixture when not installed
There's already a little trick to skip tests that use a fixture
called 'subprocess' when pytest-xprocess is not installed, but
many tests use the 'xprocess' fixture directly, and all of those
will still just fail. This just defines a dummy 'xprocess'
fixture as well as the dummy 'subprocess' fixture when xprocess
is not installed, so those tests as well will be skipped instead
of failing.
I noticed this when trying to run the test suite during build
of the Fedora package - xprocess isn't packaged for Fedora yet,
so there's no way to run the tests that use it unfortunately.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
---
tests/conftest.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tests/conftest.py b/tests/conftest.py
index ce885777a..f4611d9d0 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -29,6 +29,10 @@
@pytest.fixture(scope='session')
def subprocess():
pytest.skip('pytest-xprocess not installed.')
+
+ @pytest.fixture(scope='session')
+ def xprocess():
+ pytest.skip('pytest-xprocess not installed.')
else:
@pytest.fixture(scope='session')
def subprocess(xprocess):

View File

@ -0,0 +1,133 @@
From 7a4e8b834ee81aeeaa5dd0458b3986d33bb69de8 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Wed, 9 May 2018 15:50:50 -0700
Subject: [PATCH] Skip tests that use 'xprocess' fixture when not installed
There's a trick in conftest.py intended to allow tests to use
a fixture named 'subprocess', which will be the 'xprocess'
fixture if that's available, or will cause the test to be
skipped it it's not available. Some tests, however, just use
the 'xprocess' fixture directly, so all those tests fail if
it is not available.
We don't really need this 'subprocess' fixture at all, it
turns out - we can just do the same trick directly on the
'xprocess' fixture, so all tests can use that directly (and
also there's no confusion between this wrapper fixture and the
commonly-used Python module called...subprocess). This
simplifies things and makes the whole test suite run OK when
xprocess isn't available.
I noticed this when trying to run the test suite during build
of the Fedora package - xprocess isn't packaged for Fedora yet,
so there's no way to run the tests that use it unfortunately.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
---
tests/conftest.py | 12 ++++--------
tests/contrib/cache/test_cache.py | 12 ++++++------
2 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/tests/conftest.py b/tests/conftest.py
index ce885777a..cd78d8ceb 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -27,12 +27,8 @@
__import__('pytest_xprocess')
except ImportError:
@pytest.fixture(scope='session')
- def subprocess():
+ def xprocess():
pytest.skip('pytest-xprocess not installed.')
-else:
- @pytest.fixture(scope='session')
- def subprocess(xprocess):
- return xprocess
port_generator = count(13220)
@@ -117,7 +113,7 @@ def wait_for_reloader_loop(self):
@pytest.fixture
-def dev_server(tmpdir, subprocess, request, monkeypatch):
+def dev_server(tmpdir, xprocess, request, monkeypatch):
'''Run werkzeug.serving.run_simple in its own process.
:param application: String for the module that will be created. The module
@@ -144,7 +140,7 @@ def run_dev_server(application):
url_base = 'http://localhost:{0}'.format(port)
info = _ServerInfo(
- subprocess,
+ xprocess,
'localhost:{0}'.format(port),
url_base,
port
@@ -154,7 +150,7 @@ def preparefunc(cwd):
args = [sys.executable, __file__, str(tmpdir)]
return lambda: 'pid=%s' % info.request_pid(), args
- subprocess.ensure('dev_server', preparefunc, restart=True)
+ xprocess.ensure('dev_server', preparefunc, restart=True)
def teardown():
# Killing the process group that runs the server, not just the
diff --git a/tests/contrib/cache/test_cache.py b/tests/contrib/cache/test_cache.py
index 3e6ee7f36..0a2dac14a 100644
--- a/tests/contrib/cache/test_cache.py
+++ b/tests/contrib/cache/test_cache.py
@@ -221,7 +221,7 @@ class TestRedisCache(GenericCacheTests):
_guaranteed_deletes = True
@pytest.fixture(scope='class', autouse=True)
- def requirements(self, subprocess):
+ def requirements(self, xprocess):
if redis is None:
pytest.skip('Python package "redis" is not installed.')
@@ -229,7 +229,7 @@ def prepare(cwd):
return '[Rr]eady to accept connections', ['redis-server']
try:
- subprocess.ensure('redis_server', prepare)
+ xprocess.ensure('redis_server', prepare)
except IOError as e:
# xprocess raises FileNotFoundError
if e.errno == errno.ENOENT:
@@ -238,7 +238,7 @@ def prepare(cwd):
raise
yield
- subprocess.getinfo('redis_server').terminate()
+ xprocess.getinfo('redis_server').terminate()
@pytest.fixture(params=(None, False, True))
def make_cache(self, request):
@@ -272,7 +272,7 @@ class TestMemcachedCache(GenericCacheTests):
_can_use_fast_sleep = False
@pytest.fixture(scope='class', autouse=True)
- def requirements(self, subprocess):
+ def requirements(self, xprocess):
if memcache is None:
pytest.skip(
'Python package for memcache is not installed. Need one of '
@@ -283,7 +283,7 @@ def prepare(cwd):
return '', ['memcached']
try:
- subprocess.ensure('memcached', prepare)
+ xprocess.ensure('memcached', prepare)
except IOError as e:
# xprocess raises FileNotFoundError
if e.errno == errno.ENOENT:
@@ -292,7 +292,7 @@ def prepare(cwd):
raise
yield
- subprocess.getinfo('memcached').terminate()
+ xprocess.getinfo('memcached').terminate()
@pytest.fixture
def make_cache(self):

View File

@ -4,7 +4,7 @@
Name: python-werkzeug
Summary: A comprehensive WSGI web application library
Version: 0.14.1
Release: 4
Release: 5
License: BSD
URL: http://werkzeug.pocoo.org/
Source0: https://files.pythonhosted.org/packages/source/W/Werkzeug/%{srcname}-%{version}.tar.gz
@ -15,7 +15,7 @@ Source1: werkzeug-sphinx-theme.tar.gz
# https://github.com/pallets/werkzeug/pull/1293
# skip tests that use a fixture called 'subprocess' when pytest-xprocess
# is not installed
Patch0: 1293.patch
Patch0: Skip-tests-that-use-xprocess-fixture-when-not-installed.patch
%global _description\
Werkzeug is a comprehensive WSGI web application library. It began as a\