Update to 2.0.1

This commit is contained in:
Lumir Balhar 2021-06-22 22:35:48 +02:00
parent 6bb9b7be15
commit 2e94f6cf98
5 changed files with 155 additions and 7 deletions

1
.gitignore vendored
View File

@ -15,3 +15,4 @@ Werkzeug-0.6.2.tar.gz
/Werkzeug-0.14.1.tar.gz
/Werkzeug-0.16.0.tar.gz
/Werkzeug-1.0.1.tar.gz
/Werkzeug-2.0.1.tar.gz

View File

@ -0,0 +1,34 @@
From b88042cfb32866a00d39b678bb224eb55ecf53c1 Mon Sep 17 00:00:00 2001
From: Lumir Balhar <lbalhar@redhat.com>
Date: Tue, 22 Jun 2021 22:10:17 +0200
Subject: [PATCH] Preserve any existing PYTHONPATH in tests
---
tests/conftest.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/tests/conftest.py b/tests/conftest.py
index 4ad1ff23..7200d286 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -118,9 +118,15 @@ def dev_server(xprocess, request, tmp_path):
class Starter(ProcessStarter):
args = [sys.executable, run_path, name, json.dumps(kwargs)]
# Extend the existing env, otherwise Windows and CI fails.
- # Modules will be imported from tmp_path for the reloader.
+ # Modules will be imported from tmp_path for the reloader
+ # but any existing PYTHONPATH is preserved.
# Unbuffered output so the logs update immediately.
- env = {**os.environ, "PYTHONPATH": str(tmp_path), "PYTHONUNBUFFERED": "1"}
+ original_python_path = os.getenv("PYTHONPATH")
+ if original_python_path:
+ new_python_path = os.pathsep.join((original_python_path, str(tmp_path)))
+ else:
+ new_python_path = str(tmp_path)
+ env = {**os.environ, "PYTHONPATH": new_python_path, "PYTHONUNBUFFERED": "1"}
@cached_property
def pattern(self):
--
2.31.1

103
py310-deprecations.patch Normal file
View File

@ -0,0 +1,103 @@
From 584f3cff7d5cb8a588189ae1137b814cf5c47e05 Mon Sep 17 00:00:00 2001
From: David Lord <davidism@gmail.com>
Date: Wed, 19 May 2021 20:01:58 -0700
Subject: [PATCH] address deprecation warnings from Python 3.10b1
---
tests/conftest.py | 5 ++++-
tests/test_local.py | 34 +++++++++++++++++++++++++---------
2 files changed, 29 insertions(+), 10 deletions(-)
diff --git a/tests/conftest.py b/tests/conftest.py
index 3b5cbd71c..4ad1ff23e 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -66,7 +66,10 @@ def connect(self, **kwargs):
if protocol == "https":
if "context" not in kwargs:
- kwargs["context"] = ssl.SSLContext()
+ context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
+ context.check_hostname = False
+ context.verify_mode = ssl.CERT_NONE
+ kwargs["context"] = context
return http.client.HTTPSConnection(self.addr, **kwargs)
diff --git a/tests/test_local.py b/tests/test_local.py
index 537fc32fb..b5c392890 100644
--- a/tests/test_local.py
+++ b/tests/test_local.py
@@ -12,6 +12,18 @@
from werkzeug import local
+if sys.version_info < (3, 7):
+
+ def run_async(coro):
+ return asyncio.get_event_loop().run_until_complete(coro)
+
+
+else:
+
+ def run_async(coro):
+ return asyncio.run(coro)
+
+
def test_basic_local():
ns = local.Local()
ns.foo = 0
@@ -55,9 +67,11 @@ async def value_setter(idx):
await asyncio.sleep(0.02)
values.append(ns.foo)
- loop = asyncio.get_event_loop()
- futures = [asyncio.ensure_future(value_setter(idx)) for idx in [1, 2, 3]]
- loop.run_until_complete(asyncio.gather(*futures))
+ async def main():
+ futures = [asyncio.ensure_future(value_setter(i)) for i in [1, 2, 3]]
+ await asyncio.gather(*futures)
+
+ run_async(main())
assert sorted(values) == [1, 2, 3]
def delfoo():
@@ -118,9 +132,11 @@ async def task():
ls.push(1)
assert len(ls._local.stack) == 2
- loop = asyncio.get_event_loop()
- futures = [asyncio.ensure_future(task()) for _ in range(3)]
- loop.run_until_complete(asyncio.gather(*futures))
+ async def main():
+ futures = [asyncio.ensure_future(task()) for _ in range(3)]
+ await asyncio.gather(*futures)
+
+ run_async(main())
@pytest.mark.skipif(
@@ -571,7 +587,7 @@ async def get():
async def main():
return await p
- out = asyncio.get_event_loop().run_until_complete(main())
+ out = run_async(main())
assert out == 1
@@ -599,7 +615,7 @@ async def main():
return out
- out = asyncio.get_event_loop().run_until_complete(main())
+ out = run_async(main())
assert out == [2, 1, 0]
@@ -623,4 +639,4 @@ async def main():
assert p.value == 2
return True
- assert asyncio.get_event_loop().run_until_complete(main())
+ assert run_async(main())

View File

@ -2,14 +2,21 @@
%global modname werkzeug
Name: python-%{modname}
Version: 1.0.1
Release: 6%{?dist}
Version: 2.0.1
Release: 1%{?dist}
Summary: Comprehensive WSGI web application library
License: BSD
URL: https://werkzeug.palletsprojects.com
Source0: %{pypi_source}
# Fixes PYTHONPATH handling in tests
# Upstream: https://github.com/pallets/werkzeug/pull/2172
Patch0: preserve-any-existing-PYTHONPATH-in-tests.patch
# Fixes deprecations in Python 3.10
# Upstream: https://github.com/pallets/werkzeug/commit/584f3cff7d5cb8a588189ae1137b814cf5c47e05
Patch1: py310-deprecations.patch
BuildArch: noarch
%global _description %{expand:
@ -41,12 +48,12 @@ BuildRequires: python3dist(setuptools)
# For tests
BuildRequires: python3dist(pytest)
BuildRequires: python3dist(pytest-timeout)
# Makes tests unreliable
#BuildRequires: python3dist(pytest-xprocess)
BuildRequires: python3dist(pytest-xprocess)
BuildRequires: python3dist(requests)
BuildRequires: python3dist(requests-unixsocket)
BuildRequires: python3dist(cryptography)
BuildRequires: python3dist(greenlet)
BuildRequires: python3dist(watchdog)
%description -n python3-%{modname} %{_description}
@ -78,8 +85,7 @@ popd
%py3_install
%check
# see https://bugzilla.redhat.com/show_bug.cgi?id=1928083
%pytest -p no:unraisableexception
%pytest
%files -n python3-%{modname}
%license LICENSE.rst
@ -91,6 +97,10 @@ popd
%doc docs/_build/html examples
%changelog
* Tue Jun 22 2021 Lumír Balhar <lbalhar@redhat.com> - 2.0.1-1
- Update to 2.0.1
Resolves: rhbz#1795102
* Thu Jun 03 2021 Python Maint <python-maint@redhat.com> - 1.0.1-6
- Rebuilt for Python 3.10

View File

@ -1 +1 @@
SHA512 (Werkzeug-1.0.1.tar.gz) = ba76ee6f39cf8f6b2c8988e6119be78cc6c868ea78bd2014837b4e9f59e8b790fb3a7b5a45b392cabdc61f32b8a6902cf5f43d7e20b1f4571e0bef102a3e88fa
SHA512 (Werkzeug-2.0.1.tar.gz) = 6fb1e4fafcc352b47f2600d13db633ee2fcbcd678d453859415f792654de62135c89443ba15341efb7ff10270ae5cbf8d5120608d7dfab347d98af650f4d69f6