Skip to content

Commit 5e0ac94

Browse files
committed
Increase local.py test coverage to 100%
1 parent d350225 commit 5e0ac94

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

tests/test_local.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ async def test_local_task():
2727
del test_local.foo
2828
with pytest.raises(AttributeError):
2929
test_local.foo
30+
# Delete again now that it's already gone
31+
with pytest.raises(AttributeError):
32+
del test_local.foo
3033

3134

3235
def test_local_thread():
@@ -232,6 +235,9 @@ def sync_function():
232235
test_local.foo
233236
test_local.foo = "secret"
234237
assert test_local.foo == "secret"
238+
del test_local.foo
239+
with pytest.raises(AttributeError):
240+
del test_local.foo
235241

236242
await sync_to_async(sync_function)()
237243
# Check the value outside is not touched
@@ -419,7 +425,7 @@ async def _test() -> None:
419425

420426
@pytest.mark.asyncio
421427
async def test_deletion() -> None:
422-
"""Check visibility with asyncio tasks."""
428+
"""Check visibility of deletions with asyncio tasks."""
423429
test_local = Local()
424430
test_local.value = 123
425431

0 commit comments

Comments
 (0)