14
0

Accepting request 993302 from devel:languages:python

OBS-URL: https://build.opensuse.org/request/show/993302
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-uvicorn?expand=0&rev=7
This commit is contained in:
2022-08-08 06:45:05 +00:00
committed by Git OBS Bridge
5 changed files with 169 additions and 17 deletions

View File

@@ -1,3 +1,62 @@
-------------------------------------------------------------------
Fri Aug 5 09:51:32 UTC 2022 - Dominique Leuenberger <dimstar@opensuse.org>
- Fix URL to 1537.patch: add ".patch" to the gh Pr to reference the
raw patch, not the gh webui.
-------------------------------------------------------------------
Tue Jul 19 20:59:25 UTC 2022 - Ben Greiner <code@bnavigator.de>
- Disable testing with watchfiles
* We don't want it in Ring1-MinimalX
-------------------------------------------------------------------
Mon Jul 18 20:17:15 UTC 2022 - Ben Greiner <code@bnavigator.de>
- Update to version 0.18.2
* Add default `log_config` on `uvicorn.run()` (#1541)
* Revert `logging` file name modification (#1543)
- Release 0.18.1
* Use `DEFAULT_MAX_INCOMPLETE_EVENT_SIZE` as default to
`h11_max_incomplete_event_size` on the CLI (#1534)
- Release 0.18.0
* The `reload` flag prioritizes `watchfiles` instead of the
deprecated `watchgod` (#1437)
* Annotate `uvicorn.run()` function (#1423)
* Allow configuring `max_incomplete_event_size` for `h11`
implementation (#1514)
* Remove `asgiref` dependency (#1532)
* Turn `raw_path` into bytes on both websockets implementations
(#1487)
* Revert log exception traceback in case of invalid HTTP request
(#1518)
* Set `asyncio.WindowsSelectorEventLoopPolicy()` when using
multiple workers to avoid "WinError 87" (#1454)
- Release 0.17.5
* Fix case where url is fragmented in httptools protocol (#1263)
2/16/22
* Fix WSGI middleware not to explode quadratically in the case of
a larger body (#1329)
* Send HTTP 400 response for invalid request (#1352)
- Release 0.17.4
* Replace `create_server` by `create_unix_server` (#1362)
- Release 0.17.3
* Drop wsproto version checking. (#1359)
- Release 0.17.2
* Revert #1332. While trying to solve the memory leak, it
introduced an issue (#1345) when the server receives big chunks
of data using the `httptools` implementation. (#1354)
* Revert stream interface changes. This was introduced on 0.14.0,
and caused an issue (#1226), which caused a memory leak when
sending TCP pings. (#1355)
* Fix wsproto version check expression (#1342)
- Release 0.17.1
* Move all data handling logic to protocol and ensure connection
is closed. (#1332)
* Change `spec_version` field from "2.1" to "2.3", as Uvicorn is
compliant with that version of the ASGI specifications. (#1337)
- Add uvicorn-pr1537-no-watchgod-tests.patch gh#encode/uvicorn#1537
-------------------------------------------------------------------
Tue Feb 1 05:38:09 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>

View File

@@ -16,27 +16,29 @@
#
%{?!python_module:%define python_module() python3-%{**}}
%define skip_python2 1
Name: python-uvicorn
Version: 0.17.0
Version: 0.18.2
Release: 0
Summary: An Asynchronous Server Gateway Interface server
License: BSD-3-Clause
URL: https://github.com/encode/uvicorn
Source: https://github.com/encode/uvicorn/archive/%{version}.tar.gz#/uvicorn-%{version}.tar.gz
# PATCH-FIX-UPSTREAM uvicorn-pr1537-no-watchgod-tests.patch gh#encode/uvicorn#1537
Patch1: https://github.com/encode/uvicorn/pull/1537.patch#/uvicorn-pr1537-no-watchgod-tests.patch
BuildRequires: %{python_module base >= 3.7}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-asgiref >= 3.4
Requires: python-click >= 7.0
Requires: python-h11 >= 0.8.0
Requires: python-httptools >= 0.1.0
%if 0%{python_version_nodots} < 38
Requires: python-typing_extensions
Requires: python-websockets >= 8.0
%endif
Recommends: python-PyYAML >= 5.1
Recommends: python-httptools >= 0.4.0
Recommends: python-websockets >= 8.0
Suggests: python-uvloop >= 0.14.0
Suggests: python-watchgod >= 0.6
Suggests: python-watchfiles >= 0.13
Suggests: python-wsproto >= 0.15.0
Requires(post): update-alternatives
Requires(postun):update-alternatives
@@ -46,7 +48,7 @@ BuildRequires: %{python_module PyYAML >= 5.1}
BuildRequires: %{python_module asgiref >= 3.4}
BuildRequires: %{python_module click >= 7.0}
BuildRequires: %{python_module h11 >= 0.8.0}
BuildRequires: %{python_module httptools >= 0.1.0}
BuildRequires: %{python_module httptools >= 0.4.0}
BuildRequires: %{python_module httpx >= 0.18}
BuildRequires: %{python_module pytest-asyncio}
BuildRequires: %{python_module pytest-mock}
@@ -54,11 +56,12 @@ BuildRequires: %{python_module pytest}
BuildRequires: %{python_module python-dotenv}
BuildRequires: %{python_module requests}
BuildRequires: %{python_module trustme}
BuildRequires: %{python_module typing_extensions}
BuildRequires: %{python_module typing_extensions if %python-base < 3.8}
BuildRequires: %{python_module uvloop >= 0.14.0}
BuildRequires: %{python_module watchgod >= 0.6}
BuildRequires: %{python_module websockets >= 8.0}
BuildRequires: %{python_module wsproto >= 0.15.0}
# We don't want watchfiles in Ring1
#BuildRequires: #{python_module watchfiles >= 0.13}
# /SECTION
%python_subpackages
@@ -87,14 +90,13 @@ rm setup.cfg
%check
# Required for reporting bugs
%python_exec -m uvicorn --version
# Three wsproto upgrade related tests
# https://github.com/encode/uvicorn/issues/868
%pytest -rs -k 'not (test_supported_upgrade_request or test_invalid_upgrade)'
%pytest
%files %{python_files}
%doc README.md
%license LICENSE.md
%python_alternative %{_bindir}/uvicorn
%{python_sitelib}/*
%{python_sitelib}/uvicorn
%{python_sitelib}/uvicorn-%{version}*-info
%changelog

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a55743b07c3614dac0803dece49f406145e101905fa750d9e496cafd91f016d7
size 708241

3
uvicorn-0.18.2.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:aa30bcc7ef65b09bd30fe0afbc0cc8d79945c1f4a105dd0e1ea57f51ee6b8400
size 712706

View File

@@ -0,0 +1,91 @@
From 5bd9a221116458b0922baeadc0a51ff02ac0b56b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Fri, 24 Jun 2022 07:43:33 +0200
Subject: [PATCH] Handle missing watchfiles and watchgod gracefully in tests
Skip the tests relying on watchfiles and watchgod reloaders when
the required dependencies are not available rather than causing
an ImportError. Since these packages are optional and watchfiles
does not support all the platforms that uvicorn used to work on so far,
it is useful to be able to run at least part of the test suite there.
---
tests/supervisors/test_reload.py | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/tests/supervisors/test_reload.py b/tests/supervisors/test_reload.py
index 04bfb41cf..6010d703b 100644
--- a/tests/supervisors/test_reload.py
+++ b/tests/supervisors/test_reload.py
@@ -2,7 +2,7 @@
import signal
from pathlib import Path
from time import sleep
-from typing import Type
+from typing import Optional, Type
import pytest
@@ -10,8 +10,16 @@
from uvicorn.config import Config
from uvicorn.supervisors.basereload import BaseReload, _display_path
from uvicorn.supervisors.statreload import StatReload
-from uvicorn.supervisors.watchfilesreload import WatchFilesReload
-from uvicorn.supervisors.watchgodreload import WatchGodReload
+
+try:
+ from uvicorn.supervisors.watchfilesreload import WatchFilesReload
+except ImportError: # pragma: no cover
+ WatchFilesReload = None
+
+try:
+ from uvicorn.supervisors.watchgodreload import WatchGodReload
+except ImportError: # pragma: no cover
+ WatchGodReload = None
def run(sockets):
@@ -23,8 +31,10 @@ class TestBaseReload:
def setup(
self,
reload_directory_structure: Path,
- reloader_class: Type[BaseReload],
+ reloader_class: Optional[Type[BaseReload]],
):
+ if reloader_class is None: # pragma: no cover
+ pytest.skip("Needed dependency not installed")
self.reload_path = reload_directory_structure
self.reloader_class = reloader_class
@@ -43,7 +53,7 @@ def _setup_reloader(self, config: Config) -> BaseReload:
def _reload_tester(self, touch_soon, reloader: BaseReload, *files: Path) -> bool:
reloader.restart()
- if isinstance(reloader, WatchFilesReload):
+ if WatchFilesReload is not None and isinstance(reloader, WatchFilesReload):
touch_soon(*files)
else:
assert not next(reloader)
@@ -240,6 +250,7 @@ def test_override_defaults(self, touch_soon) -> None:
reloader.shutdown()
+ @pytest.mark.skipif(WatchFilesReload is None, reason="watchfiles not available")
@pytest.mark.parametrize("reloader_class", [WatchFilesReload])
def test_watchfiles_no_changes(self) -> None:
sub_dir = self.reload_path / "app" / "sub"
@@ -296,6 +307,7 @@ def test_should_detect_new_reload_dirs(
reloader.shutdown()
+@pytest.mark.skipif(WatchFilesReload is None, reason="watchfiles not available")
def test_should_watch_one_dir_cwd(mocker, reload_directory_structure):
mock_watch = mocker.patch("uvicorn.supervisors.watchfilesreload.watch")
app_dir = reload_directory_structure / "app"
@@ -312,6 +324,7 @@ def test_should_watch_one_dir_cwd(mocker, reload_directory_structure):
assert mock_watch.call_args[0] == (Path.cwd(),)
+@pytest.mark.skipif(WatchFilesReload is None, reason="watchfiles not available")
def test_should_watch_separate_dirs_outside_cwd(mocker, reload_directory_structure):
mock_watch = mocker.patch("uvicorn.supervisors.watchfilesreload.watch")
app_dir = reload_directory_structure / "app"