You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run compile() against tests/eval_files to catch syntax mistakes
ast.parse() accepts some code the bytecode compiler rejects (e.g.
`x = lambda: await foo()`, `return` outside a function), so a bad
test fixture could silently slip past the plugin's ast-based checks.
Add a new parametrized test that runs compile() on every
tests/eval_files/*.py. A handful of existing fixtures intentionally
contain such constructs to exercise edge cases; mark those with a new
`# NOCOMPILE` magic marker so the new test skips them while still
leaving the rest of the suite guarding against accidents.
Fixes#268
Copy file name to clipboardExpand all lines: docs/changelog.rst
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,7 @@ Unreleased
10
10
- :ref:`ASYNC910 <async910>` and :ref:`ASYNC911 <async911>` now accept ``__aenter__`` / ``__aexit__`` methods when the partner method provides the checkpoint, or when only one of the two is defined on a class that inherits from another class (charitably assuming the partner is inherited and contains a checkpoint). `(issue #441) <https://github.com/python-trio/flake8-async/issues/441>`_
11
11
- :ref:`ASYNC300 <async300>` no longer triggers when the result of ``asyncio.create_task()`` is returned from a function. `(issue #398) <https://github.com/python-trio/flake8-async/issues/398>`_
12
12
- Document using ruff's ``lint.external`` setting to preserve ``# noqa: ASYNC...`` comments when running ruff alongside flake8-async. `(issue #310) <https://github.com/python-trio/flake8-async/issues/310>`_
13
+
- Tests: each ``tests/eval_files/*.py`` fixture is now checked with ``compile()`` so that accidental semantic errors (e.g. ``lambda: await foo()``) in fixtures are caught. Files that intentionally contain such constructs are marked with ``# NOCOMPILE``. `(issue #268) <https://github.com/python-trio/flake8-async/issues/268>`_
0 commit comments