Skip to content

Removing deprecated usage of forbid_global_loop=True in pytest.mark.asyncio decorator #3542

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dev_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
16 changes: 8 additions & 8 deletions tests/test_asyncio/test_scripting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down
Loading