Skip to main content

flake8-pytest-style

pypi Python: 3.6+ Downloads Build Status Code coverage License: MIT Code style: black

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, and mocker.patch('target', lambda *args: 7) is an error

  • PT009 use a regular assert instead of unittest-style '{assertion}'

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

Unreleased

...

%### 0.2.0 - 2020-03-01

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flake8-pytest-style-0.2.0.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flake8_pytest_style-0.2.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file flake8-pytest-style-0.2.0.tar.gz.

File metadata

  • Download URL: flake8-pytest-style-0.2.0.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.7.1 Linux/4.15.0-1028-gcp

File hashes

Hashes for flake8-pytest-style-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f0a0ab6f4ff121ebd402049a93d04fb9ea149476bcd2867879f0f5b391cb7c26
MD5 ba650b6d39acca5bc68b381d3b312007
BLAKE2b-256 74eee3ac34b34cfd473e61bd7bd8d6a56b0e196929db632aaa06e7d4d66d6402

See more details on using hashes here.

File details

Details for the file flake8_pytest_style-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: flake8_pytest_style-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.7.1 Linux/4.15.0-1028-gcp

File hashes

Hashes for flake8_pytest_style-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 79537f9e4bfa2ad4a3b7528a30215c396c6cf179ae68610ffcd2de50763198c5
MD5 e947e5a7efd6523b1905d48ffb8a5d1d
BLAKE2b-256 90df21436a83ef5c1b99f16589ba5b59782768b0039dc981934f32e24cebee15

See more details on using hashes here.

Release history Release notifications | RSS feed

2.2.0

2 files

2.1.0

2 files

2.0.0

2 files

1.7.2

2 files

1.7.1

2 files

1.7.0

2 files

1.6.0

2 files

1.5.1

2 files

1.5.0

2 files

1.4.4

2 files

1.4.3

2 files

1.4.2

2 files

1.4.1

2 files

1.4.0

2 files

1.3.0

2 files

1.2.3

2 files

1.2.2

2 files

1.2.1

2 files

1.2.0

2 files

1.1.1

2 files

1.1.0

2 files

1.0.0

2 files

0.6.0

2 files

0.5.0

2 files

0.4.0

2 files

0.3.1

2 files

0.3.0

2 files

This release

0.2.0 This release

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page