Repository: strawberry-graphql/strawberry

Issue:
Bump pytest-aiohttp from 0.3.0 to 1.0.3
Bumps [pytest-aiohttp](https://github.com/aio-libs/pytest-aiohttp) from 0.3.0 to 1.0.3.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/aio-libs/pytest-aiohttp/blob/master/CHANGES.rst">pytest-aiohttp's changelog</a>.</em></p>
<blockquote>
<h2>1.0.3 (2022-01-03)</h2>
<ul>
<li>Fix <code>loop</code> and <code>proactor_loop</code> fixtures.
<code>[#22](https://github.com/aio-libs/pytest-aiohttp/issues/22) &lt;https://github.com/aio-libs/pytest-aiohttp/issue/22&gt;</code>_</li>
</ul>
<h2>1.0.2 (2022-01-20)</h2>
<ul>
<li>Restore implicit switch to <code>asyncio_mode = auto</code> if <em>legacy</em> mode is detected.</li>
</ul>
<h2>1.0.1 (2022-01-20)</h2>
<ul>
<li>Don't implicitly switch from legacy to auto asyncio_mode, the integration doesn't work
well.</li>
</ul>
<h2>1.0.0 (2022-1-20)</h2>
<ul>
<li>The plugin is compatible with <code>pytest-asyncio</code> now.  It uses <code>pytest-asyncio</code> for
async tests running and async fixtures support, providing by itself only fixtures for
creating aiohttp test server and client.</li>
</ul>
<h2>0.2.0 (2017-11-30)</h2>
<ul>
<li>Fix backward incompatibility changes introduced by <code>pytest</code> 3.3+</li>
</ul>
<h2>0.1.3 (2016-09-08)</h2>
<ul>
<li>Add MANIFEST.in file</li>
</ul>
<h2>0.1.2 (2016-08-07)</h2>
<ul>
<li>Fix README markup</li>
</ul>
<h2>0.1.1 (2016-07-22)</h2>
<ul>
<li>Fix an url in setup.py</li>
</ul>
<h2>0.1.0 (2016-07-22)</h2>
<ul>
<li>Initial release</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/aio-libs/pytest-aiohttp/commit/95dbdba5bc9fef5dd634d8a3b38b28e77afe3abe"><code>95dbdba</code></a> Update CHANGES</li>
<li><a href="https://github.com/aio-libs/pytest-aiohttp/commit/cd25f96b674869dec87c2658f307ce23f021df2c"><code>cd25f96</code></a> Fix fixture loop and proactor_loop (<a href="https://github-redirect.dependabot.com/aio-libs/pytest-aiohttp/issues/22">#22</a>)</li>
<li><a href="https://github.com/aio-libs/pytest-aiohttp/commit/4f46426126a81ec3d8912edbf1710ab706abd20d"><code>4f46426</code></a> Restore implicit switch to asyncio_mode = auto if legacy mode is detected</li>
<li><a href="https://github.com/aio-libs/pytest-aiohttp/commit/95d8d45e2e7bcca0336d78d2345eba616639071e"><code>95d8d45</code></a> Drop generated file</li>
<li><a href="https://github.com/aio-libs/pytest-aiohttp/commit/fa61ad57398a9d79470a30891110d37b5df0a4b5"><code>fa61ad5</code></a> Bump to 1.0.1</li>
<li><a href="https://github.com/aio-libs/pytest-aiohttp/commit/d0904d6f1a80ba77f84a409856e1eb03a542d64e"><code>d0904d6</code></a> Fix readme</li>
<li><a href="https://github.com/aio-libs/pytest-aiohttp/commit/84a0aa38fbde6f304453438f6770061d4a9d55c7"><code>84a0aa3</code></a> Tune readme</li>
<li><a href="https://github.com/aio-libs/pytest-aiohttp/commit/3de013a47a8ff6c1c399499a501c60a1e3175bbd"><code>3de013a</code></a> Make compatible with pytest-asyncio 0.17 (<a href="https://github-redirect.dependabot.com/aio-libs/pytest-aiohttp/issues/19">#19</a>)</li>
<li><a href="https://github.com/aio-libs/pytest-aiohttp/commit/e22c26502357f40a0ca744aba7017eb474e2889a"><code>e22c265</code></a> Update README.rst</li>
<li><a href="https://github.com/aio-libs/pytest-aiohttp/commit/1fec261bde07ca92762b5992a7c990ba6133776a"><code>1fec261</code></a> Update LICENSE</li>
<li>See full diff in <a href="https://github.com/aio-libs/pytest-aiohttp/compare/v0.3.0...v1.0.3">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=pytest-aiohttp&package-manager=pip&previous-version=0.3.0&new-version=1.0.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>


Discussion:

Resolving patch:
diff --git a/strawberry/aiohttp/handlers/http_handler.py b/strawberry/aiohttp/handlers/http_handler.py
--- a/strawberry/aiohttp/handlers/http_handler.py
+++ b/strawberry/aiohttp/handlers/http_handler.py
@@ -37,7 +37,7 @@ async def handle(self) -> web.StreamResponse:
     async def get(self, request: web.Request) -> web.StreamResponse:
         if self.should_render_graphiql(request):
             return self.render_graphiql()
-        return web.HTTPNotFound()
+        raise web.HTTPNotFound()
 
     async def post(self, request: web.Request) -> web.StreamResponse:
         request_data = await self.get_request_data(request)


Test patch:
diff --git a/tests/aiohttp/conftest.py b/tests/aiohttp/conftest.py
--- a/tests/aiohttp/conftest.py
+++ b/tests/aiohttp/conftest.py
@@ -1,10 +1,10 @@
-import pytest
+import pytest_asyncio
 
 from tests.aiohttp.app import create_app
 
 
-@pytest.fixture
-def aiohttp_app_client(loop, aiohttp_client):
+@pytest_asyncio.fixture
+async def aiohttp_app_client(event_loop, aiohttp_client):
     app = create_app(graphiql=True)
-    loop.set_debug(True)
-    return loop.run_until_complete(aiohttp_client(app))
+    event_loop.set_debug(True)
+    return await aiohttp_client(app)
diff --git a/tests/aiohttp/test_graphql_ws.py b/tests/aiohttp/test_graphql_ws.py
--- a/tests/aiohttp/test_graphql_ws.py
+++ b/tests/aiohttp/test_graphql_ws.py
@@ -16,12 +16,9 @@
 )
 from tests.aiohttp.app import create_app
 from tests.aiohttp.schema import schema
-from tests.fixtures.utils import TickEventLoopPolicy
 
 
 async def test_simple_subscription(aiohttp_client):
-    asyncio.set_event_loop_policy(TickEventLoopPolicy())
-
     app = create_app(keep_alive=False)
     aiohttp_app_client = await aiohttp_client(app)
 
@@ -101,9 +98,7 @@ async def test_operation_selection(aiohttp_client):
         assert ws.closed
 
 
-async def test_sends_keep_alive(aiohttp_client):
-    asyncio.set_event_loop_policy(TickEventLoopPolicy())
-
+async def test_sends_keep_alive(aiohttp_client, event_loop):
     app = create_app(keep_alive=True, keep_alive_interval=0.1)
     aiohttp_app_client = await aiohttp_client(app)
 
diff --git a/tests/fixtures/utils.py b/tests/fixtures/utils.py
deleted file mode 100644
--- a/tests/fixtures/utils.py
+++ /dev/null
@@ -1,29 +0,0 @@
-import asyncio
-from asyncio.base_events import BaseEventLoop
-from unittest import mock
-
-
-class TickEventLoop(BaseEventLoop):
-    """A fake event loop that uses a simple counter for the time."""
-
-    _selector = mock.Mock()
-    _selector.select.return_value = ()
-    _process_events = mock.Mock()
-
-    def __init__(self, *args, **kwargs):
-        self._current_tick = 0
-
-        super().__init__(*args, **kwargs)
-
-    def _run_once(self):
-        self._current_tick += 1
-
-        return super()._run_once()
-
-    def time(self):
-        return self._current_tick
-
-
-class TickEventLoopPolicy(asyncio.DefaultEventLoopPolicy):  # type:ignore
-    def new_event_loop(self):
-        return TickEventLoop()