Skip to main content
Travis build Read the Docs PyPI PyPI - Python Version flake8-aaa is licensed under the MIT License

Flake8-AAA

A linter for Python tests.

Flake8-AAA enforces simple formatting of your test suite making it more consistent and easier to grok, especially across teams.

Installation and usage

Flake8-AAA is a Flake8 plugin.

Install flake8-aaa with pip, which will also install flake8:

$ pip install flake8-aaa

Invoke Flake8 on your test suite, in this case in the tests directory:

$ flake8 tests

Errors returned by Flake8-AAA have the AAA code, for example:

tests/block/test_init.py:14:1: AAA02 multiple Act blocks found in test

Arrange Act Assert

Tests are linted against the Arrange Act Assert pattern.

TL;DR following the AAA pattern means tests are laid out like this:

def test():
    """
    __docstring__
    """
    <ARRANGE block> # set up of the system under test (SUT)

    <ACT block> # perform a single action on the SUT

    <ASSERT block> # check that the SUT changed as expected

For example:

def test(tmpdir):
    """
    Checker is able to parse provided file at load time
    """
    target_file = tmpdir.join('test.py')
    target_file.write('assert 1 + 2 == 3\n')
    tree = ast.parse(target_file.read())
    checker = Checker(tree, ['assert 1 + 2 == 3\n'], target_file.strpath)

    result = checker.load()

    assert result is None
    assert len(checker.tree.body) == 1
    assert type(checker.tree.body[0]) == ast.Assert
    assert len(checker.ast_tokens.tokens) == 8

More examples are in our test suite’s “good” files.

Compatibility

  • Pytest and unittest supported.

  • Compatible with Black and yapf formatted code.

  • Compatible with type-annotated code, checked with mypy.

  • Current release works with the latest versions of Python 3 (3.6, 3.7 and 3.8). Older releases have support for older Pythons.

See the Compatibility list for more info.

Resources

Metadata

Release files for flake8-aaa 0.8.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flake8-aaa 0.8.1
File Size Uploaded Provenance Actions
flake8-aaa-0.8.1.tar.gz 13.6 kB Without provenance Details for flake8-aaa-0.8.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for flake8-aaa 0.8.1
File Interpreter ABI Platform Actions
flake8_aaa-0.8.1-py3-none-any.whl Python 3 none any Details for flake8_aaa-0.8.1-py3-none-any.whl

Total release size: 29.8 kB

Release files / flake8-aaa-0.8.1.tar.gz

Download URL flake8-aaa-0.8.1.tar.gz
Size 13.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f71c7e2dde533b492e66c66e4bdbe369ef7d39f91a62e5082717966f328cfc87
BLAKE2b-256 checksum
How to use checksums
69a04ddc52c2c7412b0817e689adfaa37cf3d778aef178e30bcd1ce7f8ce7e08
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.7

Release files / flake8_aaa-0.8.1-py3-none-any.whl

Download URL flake8_aaa-0.8.1-py3-none-any.whl
Size 16.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
956193dd1343dc4a9c7a5cac5567898f62a7af4b9d0ba0f84d1b4bb0f8dbd5c0
BLAKE2b-256 checksum
How to use checksums
cfb77545ad51b430ca63de5a48f93f3210d7e7741973ed25a14b56c9dc64f81c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.7

Security for flake8-aaa 0.8.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.8.1 This release

2 release files No provenance

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