All Projects → m-burst → Flake8 Pytest Style

m-burst / Flake8 Pytest Style

Licence: other
A flake8 plugin checking common style issues or inconsistencies with pytest-based tests.

Programming Languages

python
139335 projects - #7 most used programming language
python3
1442 projects

Labels

Projects that are alternatives of or similar to Flake8 Pytest Style

Pytest Django
A Django plugin for pytest.
Stars: ✭ 872 (+1078.38%)
Mutual labels:  pytest
Pytest Mypy Plugins
pytest plugin for testing mypy types, stubs, and plugins
Stars: ✭ 47 (-36.49%)
Mutual labels:  pytest
Pytest Grpc
Allow test gRPC with pytest
Stars: ✭ 63 (-14.86%)
Mutual labels:  pytest
Pytest Cov
Coverage plugin for pytest.
Stars: ✭ 983 (+1228.38%)
Mutual labels:  pytest
Pytest Pudb
Pytest PuDB debugger integration
Stars: ✭ 45 (-39.19%)
Mutual labels:  pytest
Pytest Django Queries
Generate performance reports from your django database performance tests.
Stars: ✭ 54 (-27.03%)
Mutual labels:  pytest
Pytest Requests
HTTP(S) testing with pytest and requests.
Stars: ✭ 24 (-67.57%)
Mutual labels:  pytest
Molecule Ansible Docker Aws
Example project showing how to test Ansible roles with Molecule using Testinfra and a multiscenario approach with Docker, Vagrant & AWS EC2 as infrastructure providers
Stars: ✭ 72 (-2.7%)
Mutual labels:  pytest
Pytest Mimesis
Mimesis integration with the pytest test runner. This plugin provider useful fixtures based on providers from Mimesis.
Stars: ✭ 46 (-37.84%)
Mutual labels:  pytest
Integration tests
ManageIQ integration tests
Stars: ✭ 63 (-14.86%)
Mutual labels:  pytest
Opensourcetest
OpenSourceTest由自动化测试-夜行者社区维护,提供的是更多地灵活性和可配置性
Stars: ✭ 37 (-50%)
Mutual labels:  pytest
Pytest Idapro
A pytest module for The Interactive Disassembler and IDAPython; Record and Replay IDAPython API, execute inside IDA or use mockups of IDAPython API.
Stars: ✭ 44 (-40.54%)
Mutual labels:  pytest
Dicomweb Client
Python client for DICOMweb RESTful services
Stars: ✭ 60 (-18.92%)
Mutual labels:  pytest
Jest Pytest
A Jest and Pytest integration made in heaven 💖
Stars: ✭ 28 (-62.16%)
Mutual labels:  pytest
Wemake Django Template
Bleeding edge django template focused on code quality and security.
Stars: ✭ 1,141 (+1441.89%)
Mutual labels:  pytest
Pytest Patterns
A couple of examples showing how pytest and its plugins can be combined to solve real-world needs.
Stars: ✭ 24 (-67.57%)
Mutual labels:  pytest
Python web framework
这是一个关于python的WebUI自动化测试的项目,之前用的是unittest测试框架,现在改成pytest测试框架,Python+PageObject+Pytest
Stars: ✭ 49 (-33.78%)
Mutual labels:  pytest
Syrupy
🥞 The sweeter pytest snapshot plugin
Stars: ✭ 73 (-1.35%)
Mutual labels:  pytest
Pytest Spec
Library pytest-spec is a pytest plugin to display test execution output like a SPECIFICATION.
Stars: ✭ 65 (-12.16%)
Mutual labels:  pytest
Pyautotest
Stars: ✭ 61 (-17.57%)
Mutual labels:  pytest

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:

Code Description
PT001 use @pytest.fixture() over @pytest.fixture
(configurable by pytest-fixture-no-parentheses)
PT002 configuration for fixture '{name}' specified via positional args, use kwargs
PT003 scope='function' is implied in @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}
(configurable by pytest-parametrize-names-type)
PT007 wrong values type in @pytest.mark.parametrize, expected {expected_type}
(configurable by pytest-parametrize-values-type and pytest-parametrize-values-row-type)
PT008 use return_value= instead of patching with lambda
PT009 use a regular assert instead of unittest-style '{assertion}'
PT010 set the expected exception in pytest.raises()
PT011 set the match parameter in pytest.raises({exception})
(configurable by pytest-raises-require-match-for)
PT012 pytest.raises() block should contain a single simple statement
PT013 found incorrect import of pytest, use simple 'import pytest' instead
PT014 found duplicate test cases {indexes} in @pytest.mark.parametrize
PT015 assertion always fails, replace with pytest.fail()
PT016 no message passed to pytest.fail()
PT017 found assertion on exception {name} in except block, use pytest.raises() instead
PT018 assertion should be broken down into multiple parts
PT019 fixture {name} without value is injected as parameter, use @pytest.mark.usefixtures instead
PT020 @pytest.yield_fixture is deprecated, use @pytest.fixture
PT021 use yield instead of request.addfinalizer
PT022 no teardown in fixture {name}, use return instead of yield
PT023 use @pytest.mark.foo() over @pytest.mark.foo
(configurable by pytest-mark-no-parentheses)
PT024 pytest.mark.asyncio is unnecessary for fixtures

Installation

pip install flake8-pytest-style

Configuration

The plugin has the following configuration options:

  • pytest-fixture-no-parentheses — see PT001
  • pytest-parametrize-names-type — see PT006
  • pytest-parametrize-values-type — see PT007
  • pytest-parametrize-values-row-type — see PT007
  • pytest-raises-require-match-for — see PT011
  • pytest-mark-no-parentheses — see PT023

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

...

1.4.0 - 2021-03-14

  • add PT023 (checks for parentheses consistency in pytest.mark usage)
  • add PT024 (checks for unnecessary pytest.mark.asyncio on fixtures)
  • fix PT004, PT005 firing on abstract fixtures
  • fix PT012 firing on with statements containing a single pass

1.3.0 - 2020-08-30

  • add PT022 (checks for yield fixtures without teardown)

1.2.3 - 2020-08-06

  • update flake8-plugin-utils dependency to fix encoding problems on Windows

1.2.2 - 2020-07-23

  • fix PT004/PT005 inspecting returns of nested functions

1.2.1 - 2020-06-15

  • fix PT021 for factory fixtures (#46)

1.2.0 - 2020-06-12

  • support scoped mocker fixtures from pytest-mock for PT008
  • check for positional-only lambda arguments in PT008
  • add PT020 (checks for pytest.yield_fixture)
  • add PT021 (checks for request.addfinalizer)
  • add documentation pages for all rules

1.1.1 - 2020-04-17

  • fix PT011 not reporting match='' as a violation

1.1.0 - 2020-04-14

  • add PT015 (checks for assert False)
  • add PT016 (checks for pytest.fail() without message)
  • add PT017 (checks for assertions on exceptions in except blocks)
  • add PT018 (checks for composite assertions)
  • add PT019 (checks for fixtures without value injected as parameters)

1.0.0 - 2020-03-26

  • add PT014 (checks for duplicate test cases in @pytest.mark.parametrize)

0.6.0 - 2020-03-21

  • add configuration option pytest-parametrize-names-type for PT006
  • add configuration options pytest-parametrize-values-type and pytest-parametrize-values-row-type for PT007

0.5.0 - 2020-03-09

  • add configuration option pytest-fixture-no-parentheses for PT001
  • add PT013 (checks for from-imports from pytest)

0.4.0 - 2020-03-09

  • add PT012 (checks for multiple statements in with pytest.raises())

0.3.1 - 2020-03-09

  • fix default value of pytest-raises-require-match-for config option

0.3.0 - 2020-03-09

  • add PT010 and PT011 (checks for pytest.raises parameters)

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
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].