Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:sebix:intelmq
python-hug
fix-compatibility-pr-918.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File fix-compatibility-pr-918.patch of Package python-hug
From 7e97181f6b4e978ba892ea0e2b7d29d1ae2322cf Mon Sep 17 00:00:00 2001 From: Sebastian Wagner <swagner@intevation.de> Date: Fri, 30 Jun 2023 10:35:02 +0200 Subject: [PATCH 1/4] pkg: remove unneeded and obsolete mock requirement the mock library is obsolete and not even needed, so remove it from the test requirements --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 3d84b665..8084354e 100755 --- a/setup.py +++ b/setup.py @@ -98,7 +98,7 @@ def list_modules(dirname): requires=["falcon", "requests"], install_requires=["falcon==2.0.0", "requests"], setup_requires=["pytest-runner"], - tests_require=["pytest", "mock", "marshmallow"], + tests_require=["pytest", "marshmallow"], ext_modules=ext_modules, cmdclass=cmdclass, python_requires=">=3.5", From eecb0ff8b15057ea36175cc60b8321d002191133 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner <swagner@intevation.de> Date: Fri, 30 Jun 2023 10:36:44 +0200 Subject: [PATCH 2/4] maint: upgrade async-related python syntax coroutine functions are now declared with the 'async' keyword fixes hugapi/hug#902 --- hug/api.py | 2 +- tests/test_coroutines.py | 20 +++++++------------- tests/test_decorators.py | 3 +-- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/hug/api.py b/hug/api.py index 7179c7a4..790f0385 100644 --- a/hug/api.py +++ b/hug/api.py @@ -631,7 +631,7 @@ def _ensure_started(self): if async_handlers: loop = asyncio.get_event_loop() loop.run_until_complete( - asyncio.gather(*[handler(self) for handler in async_handlers], loop=loop) + asyncio.gather(*[handler(self) for handler in async_handlers]) ) for startup_handler in self.startup_handlers: if not startup_handler in async_handlers: diff --git a/tests/test_coroutines.py b/tests/test_coroutines.py index 556f4fea..e3775e59 100644 --- a/tests/test_coroutines.py +++ b/tests/test_coroutines.py @@ -31,8 +31,7 @@ def test_basic_call_coroutine(): """The most basic Happy-Path test for Hug APIs using async""" @hug.call() - @asyncio.coroutine - def hello_world(): + async def hello_world(): return "Hello World!" assert loop.run_until_complete(hello_world()) == "Hello World!" @@ -42,16 +41,14 @@ def test_nested_basic_call_coroutine(): """The most basic Happy-Path test for Hug APIs using async""" @hug.call() - @asyncio.coroutine - def hello_world(): + async def hello_world(): return getattr(asyncio, "ensure_future")(nested_hello_world()) @hug.local() - @asyncio.coroutine - def nested_hello_world(): + async def nested_hello_world(): return "Hello World!" - assert loop.run_until_complete(hello_world()) == "Hello World!" + assert loop.run_until_complete(hello_world()).result() == "Hello World!" def test_basic_call_on_method_coroutine(): @@ -59,8 +56,7 @@ def test_basic_call_on_method_coroutine(): class API(object): @hug.call() - @asyncio.coroutine - def hello_world(self=None): + async def hello_world(self=None): return "Hello World!" api_instance = API() @@ -79,8 +75,7 @@ def hello_world(self): api_instance = API() @hug.call() - @asyncio.coroutine - def hello_world(): + async def hello_world(): return api_instance.hello_world() assert api_instance.hello_world() == "Hello World!" @@ -94,8 +89,7 @@ class API(object): def __init__(self): hug.call()(self.hello_world_method) - @asyncio.coroutine - def hello_world_method(self): + async def hello_world_method(self): return "Hello World!" api_instance = API() diff --git a/tests/test_decorators.py b/tests/test_decorators.py index 4e180cd7..45e1e284 100644 --- a/tests/test_decorators.py +++ b/tests/test_decorators.py @@ -1586,8 +1586,7 @@ def happens_on_startup(api): happened_on_startup.append("non-async") @hug.startup(api=hug_api) - @asyncio.coroutine - def async_happens_on_startup(api): + async def async_happens_on_startup(api): happened_on_startup.append("async") assert happens_on_startup in hug_api.startup_handlers From 3e472d7230ce355dc6d509d16dceb689c6cf7a33 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner <swagner@intevation.de> Date: Fri, 30 Jun 2023 10:37:46 +0200 Subject: [PATCH 3/4] maint: fix numpy float construction numpy.float was deprecated as it was just python's float. using np.float64 explicitly --- tests/test_output_format.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_output_format.py b/tests/test_output_format.py index 75d28821..11d0e158 100644 --- a/tests/test_output_format.py +++ b/tests/test_output_format.py @@ -366,7 +366,7 @@ def test_json_converter_numpy_types(): ex_int = numpy.int_(9) ex_np_array = numpy.array([1, 2, 3, 4, 5]) ex_np_int_array = numpy.int_([5, 4, 3]) - ex_np_float = numpy.float(0.5) + ex_np_float = numpy.float64(0.5) assert 9 == hug.output_format._json_converter(ex_int) assert [1, 2, 3, 4, 5] == hug.output_format._json_converter(ex_np_array) From 1fa29da055519a1fdd4cecac5271d0e0ce883049 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner <swagner@intevation.de> Date: Fri, 30 Jun 2023 10:44:12 +0200 Subject: [PATCH 4/4] pkg: remove unneeded pytest-runner from setup requires fixes hugapi/hug#895 --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index 8084354e..ab302c20 100755 --- a/setup.py +++ b/setup.py @@ -97,7 +97,6 @@ def list_modules(dirname): packages=["hug"], requires=["falcon", "requests"], install_requires=["falcon==2.0.0", "requests"], - setup_requires=["pytest-runner"], tests_require=["pytest", "marshmallow"], ext_modules=ext_modules, cmdclass=cmdclass,
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor