A flake8 plugin checking common style issues or inconsistencies with pytest-based tests.
Project description
flake8-pytest-style
Description
A flake8
plugin checking common style issues or inconsistencies with pytest
-based tests.
Currently the following errors are reported:
-
PT001 use @pytest.fixture() over @pytest.fixture
-
PT002 configuration for fixture '{name}' specified via positional args, use kwargs
e.g.@pytest.fixture(scope='module')
is OK, and@pytest.fixture('module')
is an error -
PT003 scope='function' is implied in @pytest.fixture()
e.g.@pytest.fixture(scope='function')
should be replaced with@pytest.fixture()
-
PT004 fixture '{name}' does not return anything, add leading underscore
-
PT005 fixture '{name}' returns a value, remove leading underscore
-
PT006 wrong name(s) type in @pytest.mark.parametrize, expected {expected_type}
e.g.@pytest.mark.parametrize(('name1', 'name2'), ...)
is ok, and@pytest.mark.parametrize('name1,name2', ...)
is an error -
PT007 wrong values type in @pytest.mark.parametrize, expected {expected_type}
-
PT008 use return_value= instead of patching with lambda
e.g.mocker.patch('target', return_value=7)
is OK, andmocker.patch('target', lambda *args: 7)
is an error
Installation
pip install flake8-pytest-style
For developers
Install deps and setup pre-commit hook
make init
Run linters, autoformat, tests etc.
make format lint test
Bump new version
make bump_major
make bump_minor
make bump_patch
License
MIT
Change Log
0.1.3 - 2019-05-24
- add
yield
fixtures support - fix changelog entry for 0.1.2
0.1.2 - 2019-05-23
- fix parametrize checkers not working in decorators
0.1.1 - 2019-05-23
- update PyPI description
0.1.0 - 2019-05-23
- initial
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for flake8-pytest-style-0.1.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 820503cb50b7f6aa13a9889f4c47ba35bbd666877a72ed138ae5682a9bccaf9d |
|
MD5 | e8cd3131f1c72b5d307b4b99183d4717 |
|
BLAKE2b-256 | cec43a27f739ea596140d4858f86ab5a214a9101f81c45d21997e959c933b426 |
Hashes for flake8_pytest_style-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c2303998c509cd65c3fb047cd536787ddf953e8113bc7f086c0cd7468db4b1f |
|
MD5 | d56644f49ca14eb588d3835a19a5518f |
|
BLAKE2b-256 | a5cc6c4c3f26c12ab02c0a37c781026f89b75bcb7cb9673d153e2284f3457cf2 |