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.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
File details
Details for the file flake8-pytest-style-0.1.1.tar.gz
.
File metadata
- Download URL: flake8-pytest-style-0.1.1.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.16 CPython/3.6.3 Linux/4.4.0-101-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b57b8ca81426d34cd1396010c4e3fdb3eafaa7b261d2ab745d88484fb8ae4bf1 |
|
MD5 | b91c356b1107c603503731cb53a90822 |
|
BLAKE2b-256 | 563a5ce75e239ab5bed6931140eb9d8471ae8dd1c5933acd4ad4ca0879aae36f |
File details
Details for the file flake8_pytest_style-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: flake8_pytest_style-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.16 CPython/3.6.3 Linux/4.4.0-101-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70d183d493f0419cb861b605e62981c639d1e45b19d51941bec83cb5df6c7cea |
|
MD5 | b52d3a63607cf6cbb57c6fa458879c9d |
|
BLAKE2b-256 | 9a48333ac4a5760026daf241cbe3622d01154af3aa6dbaecceb6a6f49d6d2384 |