Registry / testing / pytest-flakes

pytest-flakes

JSON →
library4.0.5pypypi✓ verified 86d ago

A pytest plugin that checks Python source code for logical errors using pyflakes. It integrates seamlessly into the pytest ecosystem, automatically running pyflakes on all collected test files and source files. Current version 4.0.5 supports Python >=3.5. The plugin is in maintenance mode; no new features are expected.

pip install pytest-flakes
INSTALL
IMPORT
SIG · PYTEST-FLAKES
P
pytest-flakes
testingpythonv4.0.5
Install
2.9s avg
Import
547ms
Disk
30MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v4.0.5 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.580s · 31.5MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.9s · import 0.514s · 32MB
30MB installed
● package 30MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pytest_flakes
import pytest_flakes
from pytest_flakes import ...
Common mistake: users try to import submodules, but the plugin is automatically registered when installed.

Create a test file (e.g., test_demo.py). Run pytest normally. The plugin will automatically check all Python files for pyflakes errors.

import pytest import sys sys.path.insert(0, 'src') def test_ok(): x = 1 assert x
Debug
Known issues
gotchaThe plugin checks all collected Python files, not just test files. This can cause unexpected failures in third-party code if you have a large source tree. Use --flakes-ignore to exclude files.
fix
Configure pytest.ini with flakes-ignore = path/to/ignore*
affects: all
gotchaDoes not work with Python 3.10+? Actually, pyflakes supports up to Python 3.8. But pytest-flakes may still work with newer Python as long as pyflakes parses the code. However, there may be false negatives for newer syntax (match statements, etc.).
fix
Consider using flake8 for modern Python syntax support.
affects: 4.x
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pyflakes'
Missing dependency pyflakes
fix
pip install pyflakes
ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...] pytest: error: unrecognized arguments: --flakes
pytest-flakes is not installed or not activated
fix
pip install pytest-flakes and ensure it's in the test environment
Upgrade
Version history
4.0.5latest on PyPI · released Dec 2, 2021
Audit
Dependencies
pytestrequiredRequired to run the plugin
pyflakesrequiredCore dependency for code checking
Agent activity
14 hits · last 30 days
node
12
Resources
pytest-flakes — pip install pytest-flakes · libregistry