!14 [sync] PR-12: Update to 1.0.1

From: @openeuler-sync-bot
Reviewed-by: @miao_kaibo
Signed-off-by: @miao_kaibo
This commit is contained in:
openeuler-ci-bot 2021-09-06 11:37:58 +00:00 committed by Gitee
commit a4841c0497
7 changed files with 98 additions and 189 deletions

Binary file not shown.

BIN
1.0.1.tar.gz Normal file

Binary file not shown.

View File

@ -0,0 +1,67 @@
From 3a02d997ed5e2a69485b1a97e2f0a5de2e1e1b1b Mon Sep 17 00:00:00 2001
From: hht8 <huanghaitao12138@163.com>
Date: Mon, 16 Aug 2021 10:01:13 +0800
Subject: [PATCH] Disable tests because need pytest-3.9
---
tests/test_datastructures.py | 16 ----------------
tests/test_serving.py | 10 ----------
2 files changed, 26 deletions(-)
diff --git a/tests/test_datastructures.py b/tests/test_datastructures.py
index 56f170b..26043bd 100644
--- a/tests/test_datastructures.py
+++ b/tests/test_datastructures.py
@@ -1235,28 +1235,12 @@ class TestFileStorage(object):
for name in ("fileno", "writable", "readable", "seekable"):
assert hasattr(file_storage, name)
- def test_save_to_pathlib_dst(self, tmp_path):
- src = tmp_path / "src.txt"
- src.write_text(u"test")
- storage = self.storage_class(src.open("rb"))
- dst = tmp_path / "dst.txt"
- storage.save(dst)
- assert dst.read_text() == "test"
-
def test_save_to_bytes_io(self):
storage = self.storage_class(io.BytesIO(b"one\ntwo"))
dst = io.BytesIO()
storage.save(dst)
assert dst.getvalue() == b"one\ntwo"
- def test_save_to_file(self, tmp_path):
- path = tmp_path / "file.data"
- storage = self.storage_class(io.BytesIO(b"one\ntwo"))
- with path.open("wb") as dst:
- storage.save(dst)
- with path.open("rb") as src:
- assert src.read() == b"one\ntwo"
-
@pytest.mark.parametrize("ranges", ([(0, 1), (-5, None)], [(5, None)]))
def test_range_to_header(ranges):
diff --git a/tests/test_serving.py b/tests/test_serving.py
index f605f76..c4ba602 100644
--- a/tests/test_serving.py
+++ b/tests/test_serving.py
@@ -297,16 +297,6 @@ def test_reloader_reports_correct_file(tmpdir, dev_server):
raise RuntimeError("Change event not detected.")
-def test_windows_get_args_for_reloading(monkeypatch, tmp_path):
- argv = [str(tmp_path / "test.exe"), "run"]
- monkeypatch.setattr("sys.executable", str(tmp_path / "python.exe"))
- monkeypatch.setattr("sys.argv", argv)
- monkeypatch.setattr("__main__.__package__", None)
- monkeypatch.setattr("os.name", "nt")
- rv = _reloader._get_args_for_reloading()
- assert rv == argv
-
-
def test_monkeypatched_sleep(tmpdir):
# removing the staticmethod wrapper in the definition of
# ReloaderLoop._sleep works most of the time, since `sleep` is a c
--
2.23.0

View File

@ -1,133 +0,0 @@
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):

Binary file not shown.

View File

@ -1,19 +1,14 @@
%global debug_package %{nil}
%global srcname Werkzeug
%global modname werkzeug
Name: python-werkzeug
Summary: A comprehensive WSGI web application library
Version: 0.14.1
Release: 6
Version: 1.0.1
Release: 1
License: BSD
URL: http://werkzeug.pocoo.org/
Source0: https://files.pythonhosted.org/packages/source/W/Werkzeug/%{srcname}-%{version}.tar.gz
Source1: https://github.com/pallets/werkzeug/archive/0.14.1.tar.gz
# https://github.com/pallets/werkzeug/pull/1293
# skip tests that use a fixture called 'subprocess' when pytest-xprocess
# is not installed
Patch0: Skip-tests-that-use-xprocess-fixture-when-not-installed.patch
URL: https://github.com/pallets/werkzeug
Source0: https://github.com/pallets/werkzeug/archive/1.0.1.tar.gz
Patch0: Disable-tests-because-need-pytest-3.9.patch
BuildArch: noarch
%global _description\
Werkzeug is a comprehensive WSGI web application library. It began as a\
@ -52,16 +47,6 @@ BuildRequires: python2-greenlet python2-redis
%description -n python2-werkzeug %_description
%package -n python2-werkzeug-doc
Summary: Documentation for %{name}
BuildRequires: python2-sphinx
Requires: python2-werkzeug = %{version}-%{release}
%{?python_provide:%python_provide python2-werkzeug-doc}
%description -n python2-werkzeug-doc
Documentation and examples for %{name}.
%package -n python3-werkzeug
Summary: %summary
@ -77,7 +62,8 @@ BuildRequires: python3-greenlet python3-redis
%package -n python3-werkzeug-doc
Summary: Documentation for python3-werkzeug
BuildRequires: python3-sphinx
BuildRequires: python3-sphinx python3dist(pallets-sphinx-themes)
BuildRequires: python3dist(sphinx-issues) python3-sphinxcontrib-log-cabinet
Requires: python3-werkzeug = %{version}-%{release}
%{?python_provide:%python_provide python3-werkzeug-doc}
@ -86,11 +72,7 @@ Documentation and examples for python3-werkzeug.
%prep
%autosetup -n %{srcname}-%{version} -p1 -Sgit
%{__sed} -i 's/\r//' LICENSE
%{__sed} -i '1d' tests/multipart/test_collect.py
tar -xf %{SOURCE1}
find -name '_themes' -type d -exec cp -r {} docs/ \;
%autosetup -n %{modname}-%{version} -p1
rm -rf %{py3dir}
cp -a . %{py3dir}
@ -98,57 +80,42 @@ find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
%build
werkzeug_build() {
find examples/ -name '*.py' -executable | xargs chmod -x
find examples/ -name '*.png' -executable | xargs chmod -x
pushd docs
# Add a symlink to the dir with the Python module so that __version__ can be
# obtained therefrom.
ln -s ../werkzeug werkzeug
make html
popd
}
%py2_build
werkzeug_build
pushd %{py3dir}
%py3_build
werkzeug_build
pushd docs
make PYTHONPATH=../src/ SPHINXBUILD=sphinx-build-3 html
rm -v _build/html/.buildinfo
popd
popd
%install
werkzeug_install() {
%{__rm} -rf docs/_build/html/.buildinfo
%{__rm} -rf examples/cupoftee/db.pyc
}
%py2_install
werkzeug_install
pushd %{py3dir}
%py3_install
werkzeug_install
popd
cp -ar %{py3dir}/docs .
%check
PYTHONPATH=./ py.test-2
#Some tests requires the compilation environment language variable to be utf8.
export LANG=en_US.utf8
PYTHONPATH=./src/ py.test-2
pushd %{py3dir}
PYTHONPATH=./ py.test-3
PYTHONPATH=./src/ py.test-3
popd
%files -n python2-werkzeug
%license LICENSE AUTHORS
%doc PKG-INFO CHANGES.rst
%license LICENSE.rst
%doc CHANGES.rst README.rst
%{python2_sitelib}/*
%files -n python2-werkzeug-doc
%doc docs/_build/html examples
%files -n python3-werkzeug
%license LICENSE AUTHORS
%doc PKG-INFO CHANGES.rst
%license LICENSE.rst
%doc CHANGES.rst README.rst
%{python3_sitelib}/*
%files -n python3-werkzeug-doc
@ -156,5 +123,9 @@ popd
%changelog
* Tue Aug 17 2021 huanghaitao <huanghaitao8@huawei.com> - 1.0.1-1
- Update to 1.0.1
- Disable tests because need pytest-3.9
* Mon Nov 4 2019 openEuler Buildteam <buildteam@openeuler.org> - 0.14.1-4
- Package init

4
python-werkzeug.yaml Normal file
View File

@ -0,0 +1,4 @@
version_control: github
src_repo: pallets/werkzeug
tag_prefix: ""
seperator: "."