diff --git a/dev_requirements.txt b/dev_requirements.txt index 11797c98e5..2a0938bec3 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -4,7 +4,7 @@ invoke==2.2.0 mock packaging>=20.4 pytest -pytest-asyncio>=0.23.0,<0.24.0 +pytest-asyncio>=0.23.0 pytest-cov pytest-profiling==1.8.1 pytest-timeout diff --git a/pyproject.toml b/pyproject.toml index 0ab1b61bb8..22f18bb1ae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -88,6 +88,7 @@ markers = [ "experimental: run only experimental tests", "cp_integration: credential provider integration tests", ] +asyncio_default_fixture_loop_scope = "function" asyncio_mode = "auto" timeout = 30 filterwarnings = [ diff --git a/tests/test_asyncio/test_scripting.py b/tests/test_asyncio/test_scripting.py index 8375ecd787..b8e100c04a 100644 --- a/tests/test_asyncio/test_scripting.py +++ b/tests/test_asyncio/test_scripting.py @@ -28,14 +28,14 @@ async def r(self, create_redis): yield redis await redis.script_flush() - @pytest.mark.asyncio(forbid_global_loop=True) + @pytest.mark.asyncio() async def test_eval(self, r): await r.flushdb() await r.set("a", 2) # 2 * 3 == 6 assert await r.eval(multiply_script, 1, "a", 3) == 6 - @pytest.mark.asyncio(forbid_global_loop=True) + @pytest.mark.asyncio() @skip_if_server_version_lt("6.2.0") async def test_script_flush(self, r): await r.set("a", 2) @@ -55,14 +55,14 @@ async def test_script_flush(self, r): await r.script_load(multiply_script) await r.script_flush("NOTREAL") - @pytest.mark.asyncio(forbid_global_loop=True) + @pytest.mark.asyncio() async def test_evalsha(self, r): await r.set("a", 2) sha = await r.script_load(multiply_script) # 2 * 3 == 6 assert await r.evalsha(sha, 1, "a", 3) == 6 - @pytest.mark.asyncio(forbid_global_loop=True) + @pytest.mark.asyncio() async def test_evalsha_script_not_loaded(self, r): await r.set("a", 2) sha = await r.script_load(multiply_script) @@ -71,7 +71,7 @@ async def test_evalsha_script_not_loaded(self, r): with pytest.raises(exceptions.NoScriptError): await r.evalsha(sha, 1, "a", 3) - @pytest.mark.asyncio(forbid_global_loop=True) + @pytest.mark.asyncio() async def test_script_loading(self, r): # get the sha, then clear the cache sha = await r.script_load(multiply_script) @@ -80,7 +80,7 @@ async def test_script_loading(self, r): await r.script_load(multiply_script) assert await r.script_exists(sha) == [True] - @pytest.mark.asyncio(forbid_global_loop=True) + @pytest.mark.asyncio() async def test_script_object(self, r): await r.script_flush() await r.set("a", 2) @@ -97,7 +97,7 @@ async def test_script_object(self, r): # Test first evalsha block assert await multiply(keys=["a"], args=[3]) == 6 - @pytest.mark.asyncio(forbid_global_loop=True) + @pytest.mark.asyncio() async def test_script_object_in_pipeline(self, r): await r.script_flush() multiply = r.register_script(multiply_script) @@ -127,7 +127,7 @@ async def test_script_object_in_pipeline(self, r): assert await pipe.execute() == [True, b"2", 6] assert await r.script_exists(multiply.sha) == [True] - @pytest.mark.asyncio(forbid_global_loop=True) + @pytest.mark.asyncio() async def test_eval_msgpack_pipeline_error_in_lua(self, r): msgpack_hello = r.register_script(msgpack_hello_script) assert msgpack_hello.sha