From bea769135c28dad93510be0a88b12d42a277297c Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Sun, 18 Aug 2024 09:09:25 +0200 Subject: [PATCH] Update Ruff --- .pre-commit-config.yaml | 2 +- tests/integrations/test_aiohttp.py | 2 +- tests/integrations/test_fastapi.py | 2 +- tests/integrations/test_flask.py | 2 +- tests/integrations/test_starlette.py | 4 ++-- tests/test_container.py | 6 +++--- tests/test_fake_factories.py | 4 ++-- tests/test_integration.py | 4 ++-- tests/test_registry.py | 10 +++++----- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cfa6a53..ef6ebe9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,7 +9,7 @@ repos: - id: black - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.5.6 + rev: v0.6.1 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] diff --git a/tests/integrations/test_aiohttp.py b/tests/integrations/test_aiohttp.py index bcc4f8e..1eb46b6 100644 --- a/tests/integrations/test_aiohttp.py +++ b/tests/integrations/test_aiohttp.py @@ -85,7 +85,7 @@ def _app(registry): return svcs.aiohttp.init_app(Application(), registry=registry) -@pytest.mark.asyncio() +@pytest.mark.asyncio class TestAIOHTTP: async def test_aclose_registry_ok(self, app, close_me): """ diff --git a/tests/integrations/test_fastapi.py b/tests/integrations/test_fastapi.py index f28179f..c42b8c8 100644 --- a/tests/integrations/test_fastapi.py +++ b/tests/integrations/test_fastapi.py @@ -20,7 +20,7 @@ pytest.skip("FastAPI not installed", allow_module_level=True) -@pytest.mark.asyncio() +@pytest.mark.asyncio @pytest.mark.parametrize("yield_something", [True, False]) @pytest.mark.parametrize("cm", [True, False]) async def test_integration(yield_something, cm): diff --git a/tests/integrations/test_flask.py b/tests/integrations/test_flask.py index 43a3153..5f4fefc 100644 --- a/tests/integrations/test_flask.py +++ b/tests/integrations/test_flask.py @@ -151,7 +151,7 @@ def test_get_pingeable(self, app): ping._svc_type for ping in svcs.flask.get_pings() ] - @pytest.mark.asyncio() + @pytest.mark.asyncio async def test_teardown_warns_on_async_on_close(self, container): """ teardown() warns if there are async cleanups. diff --git a/tests/integrations/test_starlette.py b/tests/integrations/test_starlette.py index 0200084..1f55bf6 100644 --- a/tests/integrations/test_starlette.py +++ b/tests/integrations/test_starlette.py @@ -24,7 +24,7 @@ pytest.skip("Starlette not installed", allow_module_level=True) -@pytest.mark.asyncio() +@pytest.mark.asyncio @pytest.mark.parametrize("yield_something", [True, False]) @pytest.mark.parametrize("cm", [True, False]) async def test_integration(yield_something, cm): @@ -110,7 +110,7 @@ async def healthy(request): ) -@pytest.mark.asyncio() +@pytest.mark.asyncio async def test_get_pings(registry, container): """ Our get_pings returns registered pings. diff --git a/tests/test_container.py b/tests/test_container.py index 6e9f269..4f9838b 100644 --- a/tests/test_container.py +++ b/tests/test_container.py @@ -26,7 +26,7 @@ def test_get_pings_empty(self, container): """ assert [] == container.get_pings() - @pytest.mark.asyncio() + @pytest.mark.asyncio async def test_repr(self, registry, container): """ The repr counts correctly. @@ -74,7 +74,7 @@ def factory(): assert close_me.is_closed - @pytest.mark.asyncio() + @pytest.mark.asyncio async def test_async_context_manager(self, container, close_me): """ The container is also an async context manager that acloses on exit. @@ -109,7 +109,7 @@ def scope(): "Container was garbage-collected with pending cleanups.", ) == recwarn.list[0].message.args - @pytest.mark.asyncio() + @pytest.mark.asyncio async def test_aget_enters_sync_contextmanagers(self, container): """ aget enters (and exits) synchronous context managers. diff --git a/tests/test_fake_factories.py b/tests/test_fake_factories.py index 2222e1f..fb5b095 100644 --- a/tests/test_fake_factories.py +++ b/tests/test_fake_factories.py @@ -51,7 +51,7 @@ def test_str_cleanup_factory(): next(gen) -@pytest.mark.asyncio() +@pytest.mark.asyncio async def test_async_int_factory(): """ async_int_factory takes no arguments and returns an int. @@ -59,7 +59,7 @@ async def test_async_int_factory(): assert isinstance(await async_int_factory(), int) -@pytest.mark.asyncio() +@pytest.mark.asyncio async def test_async_str_cleanup_factory(): """ async_str_cleanup_factory takes no arguments and returns an async generator diff --git a/tests/test_integration.py b/tests/test_integration.py index 7f0e479..cbe4a15 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -295,7 +295,7 @@ def test_local_registry_is_lazy_but_only_once(container): assert reg is container._lazy_local_registry -@pytest.mark.asyncio() +@pytest.mark.asyncio class TestAsync: async def test_async_factory(self, registry, container): """ @@ -421,7 +421,7 @@ async def factory(): assert not container._instantiated assert not container._on_close - @pytest.mark.asyncio() + @pytest.mark.asyncio async def test_aclose_resilient( self, container, registry, caplog, close_me ): diff --git a/tests/test_registry.py b/tests/test_registry.py index f074459..bc6d01c 100644 --- a/tests/test_registry.py +++ b/tests/test_registry.py @@ -70,7 +70,7 @@ def test_generators_become_context_managers(self, registry): with cm(): ... - @pytest.mark.asyncio() + @pytest.mark.asyncio async def test_async_generators_become_context_managers(self, registry): """ If a generator-based factory is passed, it's automatically wrapped with @@ -198,7 +198,7 @@ def test_context_manager(self): orc.assert_called_once_with() - @pytest.mark.asyncio() + @pytest.mark.asyncio async def test_async_context_manager(self, close_me): """ The registry is also an async context manager that acloses on exit. @@ -220,7 +220,7 @@ async def closer(): not hasattr(contextlib, "aclosing"), reason="Hasn't contextlib.aclosing()", ) - @pytest.mark.asyncio() + @pytest.mark.asyncio async def test_async_empty_close(self, registry): """ Asynchronously closing an empty registry does nothing. @@ -230,7 +230,7 @@ async def test_async_empty_close(self, registry): async with svcs.Registry(): ... - @pytest.mark.asyncio() + @pytest.mark.asyncio @needs_working_async_mock async def test_aclose_mixed(self, registry): """ @@ -252,7 +252,7 @@ async def test_aclose_mixed(self, registry): async_close.assert_awaited_once() - @pytest.mark.asyncio() + @pytest.mark.asyncio @needs_working_async_mock async def test_aclose_logs_failures(self, registry, caplog): """