Skip to main content

flake8-fine-pytest

Build Status Maintainability Test Coverage PyPI version PyPI - Python Version

An extension for flake8 that validates tests structure, extra style and readability.

Right now our checker:

  1. validates existence of reason in
@pytest.mark.xfail(reason='Super annoying test, fix it later')

It helps everyone easily understand what was the problem in the first place and reduces amount of time wasted on fixing xfailed tests.

  1. validates that test modules are in the described directories. It can be configured in setup.cfg file:
allowed_test_directories= test_unit,test_integration,test_api

If file with prefix test_ is not in allowed directories list, it will raise an error:

tests/test_models.py:0:1: FP003 File tests/test_models.py is in the wrong directory.
Allowed directories: test_unit,test_integration,test_api,test_migration

Installation

pip install flake8-fine-pytest

Example

Sample file:

# test.py

@pytest.mark.xfail(reason='')
def test_xfail() -> None:
    pass

@pytest.mark.xfail
def test_xfail() -> None:
    pass

Usage:

$ flake8 test.py
test.py:1:1: FP001 xfailed test with empty reason
test.py:5:1: FP002 xfailed test without reason

Contributing

We would love you to contribute to our project. It's simple:

  1. Create an issue with bug you found or proposal you have. Wait for approve from maintainer.
  2. Create a pull request. Make sure all checks are green.
  3. Fix review comments if any.
  4. Be awesome.

Here are useful tips:

Download files

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

Source Distribution

flake8_fine_pytest-0.0.2.tar.gz (6.0 kB view details)

Uploaded Source

File details

Details for the file flake8_fine_pytest-0.0.2.tar.gz.

File metadata

  • Download URL: flake8_fine_pytest-0.0.2.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.0

File hashes

Hashes for flake8_fine_pytest-0.0.2.tar.gz
Algorithm Hash digest
SHA256 f363c973559806d6fd650c98b92517bc997cc84d4bc3402ac8e52b63b9adc58d
MD5 001bf317736b01d99e967eaa23742eb7
BLAKE2b-256 267ac3d199621354b94f63798ff602261474becc7fb083dc14462d6055d09dda

See more details on using hashes here.

Release history Release notifications | RSS feed

2.0.0

2 files

1.0.3

2 files

1.0.2

1 file

1.0.1

1 file

1.0.0

1 file

0.1.0

1 file

0.0.3

1 file

This release

0.0.2 This release

1 file

0.0.1

1 file

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