File tree Expand file tree Collapse file tree 3 files changed +35
-2
lines changed
services/web/server/tests/unit/with_dbs Expand file tree Collapse file tree 3 files changed +35
-2
lines changed Original file line number Diff line number Diff line change 7979]
8080
8181
82+ @pytest .mark .xfail (
83+ reason = "This is really weird: A first test that fails is necessary to make this test module work with pytest-asyncio>=0.24.0. "
84+ "Maybe because of module/session event loops?"
85+ )
86+ async def test_pytest_asyncio_failure (
87+ client : TestClient ,
88+ ):
89+ url = "/v0/storage/locations"
90+ assert url .startswith (PREFIX )
91+ await client .get (url )
92+
93+
8294@pytest .mark .parametrize (
8395 "user_role,expected" ,
8496 [
@@ -95,7 +107,6 @@ async def test_list_storage_locations(
95107):
96108 url = "/v0/storage/locations"
97109 assert url .startswith (PREFIX )
98-
99110 resp = await client .get (url )
100111 data , error = await assert_status (resp , expected )
101112
Original file line number Diff line number Diff line change @@ -89,6 +89,20 @@ def _resolve(*args, **kwargs) -> AnyUrl:
8989DOUBLE_ENCODE_SLASH_IN_FILE_ID = "ef944bbe-14c7-11ee-a195-02420a0f07ab%252F46ac4913-92dc-432c-98e3-2dea21d3f0ed%252Fa_text_file.txt"
9090SINGLE_ENCODE_SLASH_IN_FILE_ID = "ef944bbe-14c7-11ee-a195-02420a0f07ab%2F46ac4913-92dc-432c-98e3-2dea21d3f0ed%2Fa_text_file.txt"
9191
92+ PREFIX = "/" + "v0" + "/storage"
93+
94+
95+ @pytest .mark .xfail (
96+ reason = "This is really weird: A first test that fails is necessary to make this test module work with pytest-asyncio>=0.24.0. "
97+ "Maybe because of module/session event loops?"
98+ )
99+ async def test_pytest_asyncio_failure (
100+ client : TestClient ,
101+ ):
102+ url = "/v0/storage/locations"
103+ assert url .startswith (PREFIX )
104+ await client .get (url )
105+
92106
93107@pytest .mark .parametrize ("user_role" , [UserRole .USER ])
94108@pytest .mark .parametrize (
Original file line number Diff line number Diff line change 33# pylint: disable=unused-variable
44# pylint: disable=too-many-arguments
55
6+ import asyncio
67import random
78import sys
89import textwrap
2425
2526import aiopg .sa
2627import pytest
28+ import pytest_asyncio
2729import redis
2830import redis .asyncio as aioredis
2931import simcore_postgres_database .cli as pg_cli
@@ -204,7 +206,13 @@ async def _print_mail_to_stdout(
204206 )
205207
206208
207- @pytest .fixture
209+ @pytest_asyncio .fixture (loop_scope = "function" )
210+ async def loop () -> asyncio .AbstractEventLoop :
211+ # NOTE: This is a hack to ensure the loop is set in the aiohttp_server
212+ return asyncio .get_running_loop ()
213+
214+
215+ @pytest_asyncio .fixture (loop_scope = "function" )
208216async def web_server (
209217 app_environment : EnvVarsDict ,
210218 postgres_db : sa .engine .Engine ,
You can’t perform that action at this time.
0 commit comments