Skip to content

Commit 3a679d5

Browse files
committed
don't special case test functions now that pytest is more robust
1 parent 7d420b0 commit 3a679d5

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

flake8_async/visitors/visitor91x.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,11 @@ def leave_FunctionDef(
123123
and not self.has_await
124124
and not func_empty_body(original_node)
125125
and not func_has_decorator(original_node, "overload")
126-
# skip functions named 'text_xxx' with params, since they may be relying
127-
# on async fixtures. This is esp bad as sync funcs relying on async fixtures
128-
# is not well handled: https://github.com/pytest-dev/pytest/issues/10839
129-
# also skip funcs with @fixture and params
126+
# skip functions with @fixture and params since they may be relying
127+
# on async fixtures.
130128
and not (
131129
original_node.params.params
132-
and (
133-
original_node.name.value.startswith("test_")
134-
or func_has_decorator(original_node, "fixture")
135-
)
130+
and func_has_decorator(original_node, "fixture")
136131
)
137132
# ignore functions with no_checkpoint_warning_decorators
138133
and not fnmatch_qualified_name_cst(

tests/eval_files/async124.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ async def foo_empty_pass():
6969
pass
7070

7171

72-
# See e.g. https://github.com/agronholm/anyio/issues/803 for why one might want an async
73-
# test without awaits.
74-
async def test_async_fixture( # ASYNC910: 0, "exit", Statement("function definition", lineno)
72+
# this was previously silenced, but pytest now gives good errors on sync test + async
73+
# fixture; so in the rare case that it has to be async the user will be able to debug it
74+
async def test_async_fixture( # ASYNC124: 0 # ASYNC910: 0, "exit", Statement("function definition", lineno)
7575
my_async_fixture,
7676
):
7777
assert my_async_fixture.setup_worked_correctly

0 commit comments

Comments
 (0)