From f84d9f94e50fb3d138a59edb48c05cee4a5a01c4 Mon Sep 17 00:00:00 2001 From: David Andersson <51036209+jdkandersson@users.noreply.github.com> Date: Fri, 23 Dec 2022 19:17:58 +1100 Subject: [PATCH] Alpha (#1) * add test cases for invalid arrange * add invalid tests for act * add tests for missing arrange and act * add cases for assert * add initial checks for arrange * write checks for arrange * add checks for act start * add test for filename * add integration tests * add integration tests for docs pattern argument * add support for custom indent size * add tests against own repository * add hypothesis checks * update changelog * add documentation * add workflows --- .devcontainer/devcontainer.json | 10 + .flake8 | 8 + .github/workflows/ci-cd.yaml | 141 ++++ .vscode/settings.json | 5 + CHANGELOG.md | 18 + README.md | 181 ++++- flake8_test_docs.py | 491 ++++++++++++ poetry.lock | 783 +++++++++++++++++++ poetry.toml | 2 + pyproject.toml | 68 ++ tests/__init__.py | 1 + tests/test_flake8_test_docs_integration.py | 241 ++++++ tests/test_flake8_test_docs_unit.py | 860 +++++++++++++++++++++ tox.ini | 61 ++ 14 files changed, 2869 insertions(+), 1 deletion(-) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .flake8 create mode 100644 .github/workflows/ci-cd.yaml create mode 100644 .vscode/settings.json create mode 100644 CHANGELOG.md create mode 100644 flake8_test_docs.py create mode 100644 poetry.lock create mode 100644 poetry.toml create mode 100644 pyproject.toml create mode 100644 tests/__init__.py create mode 100644 tests/test_flake8_test_docs_integration.py create mode 100644 tests/test_flake8_test_docs_unit.py create mode 100644 tox.ini diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..14731a2 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,10 @@ +{ + "name": "Python 3", + "image": "mcr.microsoft.com/devcontainers/python:0-3.11", + "features": { + "ghcr.io/devcontainers/features/python:1": {}, + "ghcr.io/devcontainers-contrib/features/black:1": {}, + "ghcr.io/devcontainers-contrib/features/tox:1": {}, + "ghcr.io/devcontainers-contrib/features/isort:1": {} + } +} \ No newline at end of file diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..250c478 --- /dev/null +++ b/.flake8 @@ -0,0 +1,8 @@ +[flake8] +max-line-length = 99 +max-doc-length = 99 +extend-ignore = E203,W503 +per-file-ignores = + tests/*:D205,D400 + flake8_test_docs.py:N802 +test-docs-pattern = given/when/then diff --git a/.github/workflows/ci-cd.yaml b/.github/workflows/ci-cd.yaml new file mode 100644 index 0000000..5be1764 --- /dev/null +++ b/.github/workflows/ci-cd.yaml @@ -0,0 +1,141 @@ +name: CI-CD + +on: + push: + branches: + - main + tags: + - "v[0-9]+.[0-9]+.[0-9]+" + pull_request: + branches: + - main + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.11' + - name: Install tox + run: python -m pip install tox + - name: Run linting + run: tox -e lint + test: + name: Test + runs-on: ubuntu-latest + strategy: + matrix: + python-version: + - "3.8" + - "3.9" + - "3.10" + - "3.11" + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install tox + run: python -m pip install tox + - name: Run testing + run: tox -e test + build: + runs-on: ubuntu-latest + needs: + - test + - lint + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.11" + - name: Install poetry + run: pip install poetry + - uses: actions/cache@v3 + id: cache-poetry + with: + path: ~/.virtualenvs + key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock', 'poetry.toml') }} + - name: Configure poetry for ci + run: | + poetry config virtualenvs.in-project false --local + poetry config virtualenvs.path ~/.virtualenvs --local + - name: Install dependencies + if: steps.cache-poetry.outputs.cache-hit != 'true' + run: | + poetry install + - name: Build packages + run: poetry build + - name: Upload artifacts for release + if: startsWith(github.ref, 'refs/tags/') + uses: actions/upload-artifact@v3 + with: + name: wheel + path: dist/ + release-test-pypi: + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + needs: + - build + steps: + - name: Retrieve packages + uses: actions/download-artifact@v3 + with: + name: wheel + path: dist/ + - name: Publish distribution 📦 to Test PyPI + uses: pypa/gh-action-pypi-publish@v1.6.4 + with: + password: ${{ secrets.test_pypi_password }} + repository_url: https://test.pypi.org/legacy/ + release-pypi: + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + needs: + - release-test-pypi + steps: + - name: Retrieve packages + uses: actions/download-artifact@v3 + with: + name: wheel + path: dist/ + - name: Publish distribution 📦 to PyPI + if: startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@v1.6.4 + with: + password: ${{ secrets.pypi_password }} + repository_url: https://upload.pypi.org/legacy/ + release-github: + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + needs: + - release-pypi + steps: + - name: Get version from tag + id: tag_name + run: | + echo ::set-output name=current_version::${GITHUB_REF#refs/tags/v} + shell: bash + - uses: actions/checkout@v3 + - name: Get latest Changelog Entry + id: changelog_reader + uses: mindsers/changelog-reader-action@v2 + with: + version: v${{ steps.tag_name.outputs.current_version }} + path: ./CHANGELOG.md + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.changelog_reader.outputs.version }} + release_name: Release ${{ steps.changelog_reader.outputs.version }} + body: ${{ steps.changelog_reader.outputs.changes }} + prerelease: ${{ steps.changelog_reader.outputs.status == 'prereleased' }} + draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..da5d154 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "python.analysis.typeCheckingMode": "basic", + "python.linting.pylintEnabled": true, + "python.linting.enabled": true +} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..d02119d --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,18 @@ +# Changelog + +## [Unreleased] + +## [v1.0.0] - 2022-12-23 + +### Added + +- Lint checks for test docs using the arrange/act/assert pattern +- Lint checks for longer descriptions of each stage +- `--test-docs-pattern` argument to customise the docstring pattern +- `--test-docs-filename-pattern` argument to customise the test file discovery +- `--test-docs-function-pattern` argument to customise the test function + discovery +- support for flake8 `--indent-size` argument + +[//]: # "Release links" +[v1.0.0]: https://github.com/jdkandersson/flake8-test-docs/releases/v1.0.0 diff --git a/README.md b/README.md index 44364f1..5fcadff 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,181 @@ # flake8-test-docs -Linter that checks test docstrings for the arrange/act/assert or given/when/then structure + +Have you ever needed to understand a new project and started reading the tests +only to find that you have no idea what the tests are doing? Good test +documentation is critical during test definition and when reviewing tests +written in the past or by someone else. This linter checks that the test +function docstring includes a description of the test setup, execution and +checks. + +## Getting Started + +```shell +python -m venv venv +source ./venv/bin/activate +pip install flake8 flake8-test-docs +flake8 test_source.py +``` + +On the following code: + +```Python +# test_source.py +def test_foo(): + value = foo() + assert value == "bar" +``` + +This will produce warnings such as: + +```shell +flake8 test_source.py +test_source.py:2:1: TDO001 Docstring not defined on test function, more information: https://github.com/jdkandersson/flake8-test-docs#fix-tdo001 +``` + +This can be resolved by changing the code to: + +```Python +# test_source.py +def test_foo(): + """ + arrange: given foo that returns bar + act: when foo is called + assert: then bar is returned + """ + value = foo() + assert value == "bar" +``` + +## Configuration + +The plugin adds the following configurations to `flake8`: + +* `--test-docs-patter`: The pattern the test documentation should follow, + e.g., `given/when/then`. Defaults to `arrange/act/assert`. +* `--test-docs-filename-pattern`: The filename pattern for test files. Defaults + to `test_.*.py`. +* `--test-docs-function-pattern`: The function pattern for test functions. + Defaults to `test_.*`. + + +## Rules + +A few rules have been defined to allow for selective suppression: + +* `TDO001`: checks that test functions have a docstring. +* `TDO002`: checks that test function docstrings follow the documentation + pattern. + +### Fix TDO001 + +This linting rule is triggered by a test function in a test file without a +docstring. For example: + +```Python +# test_source.py +def test_foo(): + result = foo() + assert result == "bar" +``` + +This example can be fixed by: + +```Python +# test_source.py +def test_foo(): + """ + arrange: given foo that returns bar + act: when foo is called + assert: then bar is returned + """ + result = foo() + assert result == "bar" +``` + +### Fix TDO002 + +This linting rule is triggered by a test function in a test file with a +docstring that doesn't follow the documentation pattern. For example: + +```Python +# test_source.py +def test_foo(): + """Test foo.""" + result = foo() + assert result == "bar" +``` + +This example can be fixed by: + +```Python +# test_source.py +def test_foo(): + """ + arrange: given foo that returns bar + act: when foo is called + assert: then bar is returned + """ + result = foo() + assert result == "bar" +``` + +The message of the linting rule should give you the specific problem with the +documentation. In general, the pattern is: + +* start on the second line with the same indentation is the start of the + docstring +* the starting line should begin with `arrange:` (or whatever was set using + `--test-docs-patter`) followed by at least some words describing the test + setup +* long test setup descriptions can be broken over multiple lines by indenting + the lines after the first by one level (e.g., 4 spaces by default) +* this is followed by similar sections starting with `act:` describing the test + execution and `assert:` describing the checks +* the last line should be indented the same as the start of the docstring + +Below are some valid examples. Starting with a vanilla example: + +```Python +# test_source.py +def test_foo(): + """ + arrange: given foo that returns bar + act: when foo is called + assert: then bar is returned + """ + result = foo() + assert result == "bar" +``` + +Here is an example where the test function is in a nested scope: + +```Python +# test_source.py +class TestSuite: + + def test_foo(): + """ + arrange: given foo that returns bar + act: when foo is called + assert: then bar is returned + """ + result = foo() + assert result == "bar" +``` + +Here is an example where each of the descriptions go over multiple lines: + +```Python +# test_source.py +def test_foo(): + """ + arrange: given foo + that returns bar + act: when foo + is called + assert: then bar + is returned + """ + result = foo() + assert result == "bar" +``` diff --git a/flake8_test_docs.py b/flake8_test_docs.py new file mode 100644 index 0000000..2723362 --- /dev/null +++ b/flake8_test_docs.py @@ -0,0 +1,491 @@ +"""A linter that checks test docstrings for the arrange/act/assert structure.""" + +import argparse +import ast +import re +import sys +from functools import wraps +from pathlib import Path +from typing import Callable, Iterable, List, NamedTuple, Optional, Tuple, Type + +from flake8.options.manager import OptionManager + +# One or the other line can't be covered depending on the Python version +if sys.version_info < (3, 11): # pragma: nocover + import toml as tomllib +else: # pragma: nocover + import tomllib + +ERROR_CODE_PREFIX = next( + iter( + tomllib.loads(Path("pyproject.toml").read_text(encoding="utf-8"))["tool"]["poetry"][ + "plugins" + ]["flake8.extension"].keys() + ) +) +MORE_INFO_BASE = "more information: https://github.com/jdkandersson/flake8-test-docs" +MISSING_CODE = f"{ERROR_CODE_PREFIX}001" +MISSING_MSG = ( + f"{MISSING_CODE} Docstring not defined on test function, " + f"{MORE_INFO_BASE}#fix-{MISSING_CODE.lower()}" +) +INVALID_CODE = f"{ERROR_CODE_PREFIX}002" +INVALID_MSG_POSTFIX = f", {MORE_INFO_BASE}#fix-{INVALID_CODE.lower()}" +TEST_DOCS_PATTERN_ARG_NAME = "--test-docs-pattern" +TEST_DOCS_PATTERN_DEFAULT = "arrange/act/assert" +TEST_DOCS_FILENAME_PATTERN_ARG_NAME = "--test-docs-filename-pattern" +TEST_DOCS_FILENAME_PATTERN_DEFAULT = r"test_.*.py" +TEST_DOCS_FUNCTION_PATTERN_ARG_NAME = "--test-docs-function-pattern" +TEST_DOCS_FUNCTION_PATTERN_DEFAULT = r"test_.*" +INDENT_SIZE_ARN_NAME = "--indent-size" +INDENT_SIZE_DEFAULT = 4 +ARRANGE_DESCRIPTION = "setup" +ACT_DESCRIPTION = "execution" +ASSERT_DESCRIPTION = "checks" + + +# Helper function for option management, tested in integration tests +def _cli_arg_name_to_attr(cli_arg_name: str) -> str: + """Transform CLI argument name to the attribute name on the namespace. + + Args: + cli_arg_name: The CLI argument name to transform. + + Returns: + The namespace name for the argument. + """ + return cli_arg_name.lstrip("-").replace("-", "_") # pragma: nocover + + +class DocsPattern(NamedTuple): + """Represents the pattern for the docstring. + + Attrs: + arrange: The prefix for the test setup description. + act: The prefix for the test execution description. + assert_: The prefix for the test checks description. + """ + + arrange: str + act: str + assert_: str + + +class Section(NamedTuple): + """Information about a section. + + Attrs: + index_: The index of the first line of the section in the docstring. + name: A short description of the section. + description: What the section does. + next_section_name: The name of the next section or None if it is the last section. + """ + + index_: int + name: str + description: str + next_section_name: Optional[str] + + +def _append_invalid_msg_prefix_postfix( + func: Callable[..., Optional[str]] +) -> Callable[..., Optional[str]]: + """Add the code prefix and invalid message postfix to the return value. + + Args: + func: The function to wrap. + + Returns: + The wrapped function. + """ + + @wraps(func) + def wrapper(*args, **kwargs): + """Wrap the function.""" + if (return_value := func(*args, **kwargs)) is None: + return None + return f"{INVALID_CODE} {return_value}{INVALID_MSG_POSTFIX}" + + return wrapper + + +def _section_start_problem_message( + line: str, section: Section, col_offset: int, section_prefix: str +) -> Optional[str]: + """Check the first line of a section. + + Args: + line: The line to check + section: Information about the section. + col_offset: The column offset where the docstring definition starts. + section_prefix: The prefix expected at the start of a section. + + Returns: + The problem description if the line has problems or None. + """ + if not line: + return ( + "there should only be a single empty line at the start of the docstring, found an " + f"empty line on line {section.index_}" + ) + if section.name not in line: + return ( + f'the docstring should include "{section.name}" describing the test ' + f"{section.description} on line {section.index_} of the docstring" + ) + if not line.startswith(section_prefix): + return ( + f"the indentation of line {section.index_} of the docstring should match the " + "indentation of the docstring" + ) + if not line[col_offset:].startswith(f"{section.name}:"): + return f'line {section.index_} of the docstring should start with "{section.name}:"' + if not line[col_offset + len(section.name) + 1 :]: + return ( + f'"{section.name}:" should be followed by a description of the test ' + f"{section.description} on line {section.index_} of the docstring" + ) + + return None + + +def _next_section_start(line: str, next_section_name: Optional[str], section_prefix: str) -> bool: + """Detect whether the line is the start of the next section. + + The next section is defined to be either that the line starts with the next section name after + any whitespace or that the line starts with exactly the number of or fewer whitespace + characters expected for a new section. + + Args: + line: The line to check. + next_section_name: The name of the next section or None if it is the last section. + section_prefix: The prefix expected at the start of a section. + + Returns: + Whether the line is the start of the next section. + """ + if next_section_name is not None and line.strip().startswith(next_section_name): + return True + + if len(line) < len(section_prefix) and line.count(" ") == len(line): + return True + + if line.startswith(section_prefix) and not line[len(section_prefix) :].startswith(" "): + return True + + return False + + +def _remaining_description_problem_message( + section: Section, + docstring_lines: List[str], + section_prefix: str, + description_prefix: str, + indent_size: int, +) -> Tuple[Optional[str], int]: + """Check the remaining description of a section after the first line. + + Args: + section: Information about the section. + docstring_lines: All the lines of the docstring. + section_prefix: The prefix expected at the start of a section. + description_prefix: The prefix expected at the start of description line. + indent_size: The number of indentation characters. + + Returns: + The problem message if there is a problem or None and the index of the start index of the + next section. + """ + line_index = section.index_ + 1 + for line_index in range(line_index, len(docstring_lines)): + line = docstring_lines[line_index] + + if not line: + return ( + f"there should not be an empty line in the test {section.description} description " + f"on line {line_index} of the docstring" + ), line_index + + # Detecting the start of the next section + if _next_section_start( + line=line, next_section_name=section.next_section_name, section_prefix=section_prefix + ): + break + + if not line.startswith(description_prefix) or line[len(description_prefix) :].startswith( + " " + ): + return ( + f"test {section.description} description on line {line_index} should be indented " + f'by {indent_size} more spaces than "{section.name}:" on line {section.index_}' + ), line_index + + return None, line_index + + +@_append_invalid_msg_prefix_postfix +def _docstring_problem_message( + docstring: str, col_offset: int, docs_pattern: DocsPattern, indent_size: int +) -> Optional[str]: + """Get the problem message for a docstring. + + Args: + docstring: The docstring to check. + col_offset: The column offset where the docstring definition starts. + docs_pattern: The pattern the docstring should follow. + indent_size: The number of indentation characters. + + Returns: + The problem message explaining what is wrong with the docstring or None if it is valid. + """ + if not docstring: + return "the docstring should not be empty" + + if not docstring.startswith("\n"): + return "the docstring should start with an empty line" + + docstring_lines = docstring.splitlines() + section_prefix = " " * col_offset + description_prefix = f"{section_prefix}{' ' * indent_size}" + + sections = zip( + docs_pattern, + (ARRANGE_DESCRIPTION, ACT_DESCRIPTION, ASSERT_DESCRIPTION), + (*docs_pattern[1:], None), + ) + section_index = 1 + for section_name, section_description, next_section_name in sections: + section = Section( + index_=section_index, + name=section_name, + description=section_description, + next_section_name=next_section_name, + ) + start_problem = _section_start_problem_message( + line=docstring_lines[section.index_], + section=section, + col_offset=col_offset, + section_prefix=section_prefix, + ) + if start_problem is not None: + return start_problem + description_problem, section_index = _remaining_description_problem_message( + section=section, + docstring_lines=docstring_lines, + section_prefix=section_prefix, + description_prefix=description_prefix, + indent_size=indent_size, + ) + if description_problem is not None: + return description_problem + + if len(docstring_lines) <= section_index or docstring_lines[section_index] != section_prefix: + return ( + f"the indentation of the last line of the docstring at line {section_index} should " + "match the indentation of the docstring" + ) + + return None + + +class Problem(NamedTuple): + """Represents a problem within the code. + + Attrs: + lineno: The line number the problem occurred on + col_offset: The column the problem occurred on + msg: The message explaining the problem + """ + + lineno: int + col_offset: int + msg: str + + +class Visitor(ast.NodeVisitor): + """Visits AST nodes and check docstrings of test functions. + + Attrs: + problems: All the problems that were encountered. + """ + + problems: List[Problem] + _test_docs_pattern: DocsPattern + _test_function_pattern: str + _indent_size: int + + def __init__( + self, test_docs_pattern: DocsPattern, test_function_pattern: str, indent_size: int + ) -> None: + """Construct.""" + self.problems = [] + self._test_docs_pattern = test_docs_pattern + self._test_function_pattern = test_function_pattern + self._indent_size = indent_size + + # The function must be called the same as the name of the node + def visit_FunctionDef(self, node: ast.FunctionDef) -> None: # pylint: disable=invalid-name + """Visit all FunctionDef nodes. + + Args: + node: The FunctionDef node. + """ + if re.match(self._test_function_pattern, node.name): + # need checks to be in one expression so that mypy works + if ( + not node.body # pylint: disable=too-many-boolean-expressions + or not isinstance(node.body, list) + or not isinstance(node.body[0], ast.Expr) + or not hasattr(node.body[0], "value") + or not isinstance(node.body[0].value, ast.Constant) + or not isinstance(node.body[0].value.value, str) + ): + self.problems.append(Problem(node.lineno, node.col_offset, MISSING_MSG)) + else: + if problem_message := _docstring_problem_message( + node.body[0].value.value, + node.body[0].value.col_offset, + self._test_docs_pattern, + indent_size=self._indent_size, + ): + self.problems.append( + Problem( + node.body[0].value.lineno, + node.body[0].value.col_offset, + problem_message, + ) + ) + + # Ensure recursion continues + self.generic_visit(node) + + +class Plugin: + """Checks test docstrings for the arrange/act/assert structure. + + Attrs: + name: The name of the plugin. + version: The version of the plugin. + """ + + name = __name__ + version = tomllib.loads(Path("pyproject.toml").read_text(encoding="utf-8"))["tool"]["poetry"][ + "version" + ] + _test_docs_pattern: DocsPattern = DocsPattern(*TEST_DOCS_PATTERN_DEFAULT.split("/")) + _test_docs_filename_pattern: str = TEST_DOCS_FILENAME_PATTERN_DEFAULT + _test_docs_function_pattern: str = TEST_DOCS_FUNCTION_PATTERN_DEFAULT + _indent_size: int = INDENT_SIZE_DEFAULT + _filename: str + + def __init__(self, tree: ast.AST, filename: str) -> None: + """Construct. + + Args: + tree: The AST syntax tree for a file. + filename: The name of the file being processed. + """ + self._tree = tree + self._filename = filename + + # No coverage since this only occurs from the command line + @staticmethod + def _check_docs_pattern(value: str) -> str: # pragma: nocover + """Check the docs pattern argument. + + Args: + value: The docs pattern argument value to check. + + Returns: + The value if it is valid. + + Raises: + ValueError: if the value is invalid. + """ + if value.count("/") != 2: + raise ValueError( + f"the {TEST_DOCS_PATTERN_ARG_NAME} must follow the pattern " + f"//, got: {value}" + ) + return value + + # No coverage since this only occurs from the command line + @staticmethod + def add_options(option_manager: OptionManager) -> None: # pragma: nocover + """Add additional options to flake8. + + Args: + option_manager: The flake8 OptionManager. + """ + option_manager.add_option( + TEST_DOCS_PATTERN_ARG_NAME, + default=TEST_DOCS_PATTERN_DEFAULT, + type=Plugin._check_docs_pattern, + parse_from_config=True, + help=( + "The expected test docs pattern, needs to be of the form // " + "which represents an equivalent of the arrange/act/assert, e.g., given/when/then. " + f"(Default: {TEST_DOCS_PATTERN_DEFAULT})" + ), + ) + option_manager.add_option( + TEST_DOCS_FILENAME_PATTERN_ARG_NAME, + default=TEST_DOCS_FILENAME_PATTERN_DEFAULT, + parse_from_config=True, + help=( + "The pattern to match test files with. " + f"(Default: {TEST_DOCS_FILENAME_PATTERN_DEFAULT})" + ), + ) + option_manager.add_option( + TEST_DOCS_FUNCTION_PATTERN_ARG_NAME, + default=TEST_DOCS_FUNCTION_PATTERN_DEFAULT, + parse_from_config=True, + help=( + "The pattern to match test functions with. " + f"(Default: {TEST_DOCS_FUNCTION_PATTERN_DEFAULT})" + ), + ) + + # No coverage since this only occurs from the command line + @classmethod + def parse_options(cls, options: argparse.Namespace) -> None: # pragma: nocover + """Record the value of the options. + + Args: + options: The options passed to flake8. + """ + test_docs_pattern_arg = ( + getattr(options, _cli_arg_name_to_attr(TEST_DOCS_PATTERN_ARG_NAME), None) + or TEST_DOCS_PATTERN_DEFAULT + ) + cls._test_docs_pattern = DocsPattern(*test_docs_pattern_arg.split("/")) + cls._test_docs_filename_pattern = ( + getattr(options, _cli_arg_name_to_attr(TEST_DOCS_FILENAME_PATTERN_ARG_NAME), None) + or cls._test_docs_filename_pattern + ) + cls._test_docs_function_pattern = ( + getattr(options, _cli_arg_name_to_attr(TEST_DOCS_FUNCTION_PATTERN_ARG_NAME), None) + or cls._test_docs_function_pattern + ) + cls._indent_size = ( + getattr(options, _cli_arg_name_to_attr(INDENT_SIZE_ARN_NAME), None) or cls._indent_size + ) + + def run(self) -> Iterable[Tuple[int, int, str, Type["Plugin"]]]: + """Lint a file. + + Yields: + All the issues that were found. + """ + if not re.match(self._test_docs_filename_pattern, Path(self._filename).name): + return + + visitor = Visitor( + self._test_docs_pattern, self._test_docs_function_pattern, self._indent_size + ) + visitor.visit(self._tree) + yield from ( + (problem.lineno, problem.col_offset, problem.msg, type(self)) + for problem in visitor.problems + ) diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 0000000..962a5ee --- /dev/null +++ b/poetry.lock @@ -0,0 +1,783 @@ +# This file is automatically @generated by Poetry and should not be changed by hand. + +[[package]] +name = "astpretty" +version = "3.0.0" +description = "Pretty print the output of python stdlib `ast.parse`." +category = "dev" +optional = false +python-versions = ">=3.8" +files = [ + {file = "astpretty-3.0.0-py2.py3-none-any.whl", hash = "sha256:15bfd47593667169485a1fa7938b8de9445b11057d6f2b6e214b2f70667f94b6"}, + {file = "astpretty-3.0.0.tar.gz", hash = "sha256:b08c95f32e5994454ea99882ff3c4a0afc8254c38998a0ed4b479dba448dc581"}, +] + +[[package]] +name = "astroid" +version = "2.12.13" +description = "An abstract syntax tree for Python with inference support." +category = "dev" +optional = false +python-versions = ">=3.7.2" +files = [ + {file = "astroid-2.12.13-py3-none-any.whl", hash = "sha256:10e0ad5f7b79c435179d0d0f0df69998c4eef4597534aae44910db060baeb907"}, + {file = "astroid-2.12.13.tar.gz", hash = "sha256:1493fe8bd3dfd73dc35bd53c9d5b6e49ead98497c47b2307662556a5692d29d7"}, +] + +[package.dependencies] +lazy-object-proxy = ">=1.4.0" +typing-extensions = {version = ">=3.10", markers = "python_version < \"3.10\""} +wrapt = [ + {version = ">=1.11,<2", markers = "python_version < \"3.11\""}, + {version = ">=1.14,<2", markers = "python_version >= \"3.11\""}, +] + +[[package]] +name = "attrs" +version = "22.2.0" +description = "Classes Without Boilerplate" +category = "dev" +optional = false +python-versions = ">=3.6" +files = [ + {file = "attrs-22.2.0-py3-none-any.whl", hash = "sha256:29e95c7f6778868dbd49170f98f8818f78f3dc5e0e37c0b1f474e3561b240836"}, + {file = "attrs-22.2.0.tar.gz", hash = "sha256:c9227bfc2f01993c03f68db37d1d15c9690188323c067c641f1a35ca58185f99"}, +] + +[package.extras] +cov = ["attrs[tests]", "coverage-enable-subprocess", "coverage[toml] (>=5.3)"] +dev = ["attrs[docs,tests]"] +docs = ["furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib-towncrier", "towncrier", "zope.interface"] +tests = ["attrs[tests-no-zope]", "zope.interface"] +tests-no-zope = ["cloudpickle", "cloudpickle", "hypothesis", "hypothesis", "mypy (>=0.971,<0.990)", "mypy (>=0.971,<0.990)", "pympler", "pympler", "pytest (>=4.3.0)", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-mypy-plugins", "pytest-xdist[psutil]", "pytest-xdist[psutil]"] + +[[package]] +name = "black" +version = "22.12.0" +description = "The uncompromising code formatter." +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "black-22.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9eedd20838bd5d75b80c9f5487dbcb06836a43833a37846cf1d8c1cc01cef59d"}, + {file = "black-22.12.0-cp310-cp310-win_amd64.whl", hash = "sha256:159a46a4947f73387b4d83e87ea006dbb2337eab6c879620a3ba52699b1f4351"}, + {file = "black-22.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d30b212bffeb1e252b31dd269dfae69dd17e06d92b87ad26e23890f3efea366f"}, + {file = "black-22.12.0-cp311-cp311-win_amd64.whl", hash = "sha256:7412e75863aa5c5411886804678b7d083c7c28421210180d67dfd8cf1221e1f4"}, + {file = "black-22.12.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c116eed0efb9ff870ded8b62fe9f28dd61ef6e9ddd28d83d7d264a38417dcee2"}, + {file = "black-22.12.0-cp37-cp37m-win_amd64.whl", hash = "sha256:1f58cbe16dfe8c12b7434e50ff889fa479072096d79f0a7f25e4ab8e94cd8350"}, + {file = "black-22.12.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:77d86c9f3db9b1bf6761244bc0b3572a546f5fe37917a044e02f3166d5aafa7d"}, + {file = "black-22.12.0-cp38-cp38-win_amd64.whl", hash = "sha256:82d9fe8fee3401e02e79767016b4907820a7dc28d70d137eb397b92ef3cc5bfc"}, + {file = "black-22.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:101c69b23df9b44247bd88e1d7e90154336ac4992502d4197bdac35dd7ee3320"}, + {file = "black-22.12.0-cp39-cp39-win_amd64.whl", hash = "sha256:559c7a1ba9a006226f09e4916060982fd27334ae1998e7a38b3f33a37f7a2148"}, + {file = "black-22.12.0-py3-none-any.whl", hash = "sha256:436cc9167dd28040ad90d3b404aec22cedf24a6e4d7de221bec2730ec0c97bcf"}, + {file = "black-22.12.0.tar.gz", hash = "sha256:229351e5a18ca30f447bf724d007f890f97e13af070bb6ad4c0a441cd7596a2f"}, +] + +[package.dependencies] +click = ">=8.0.0" +mypy-extensions = ">=0.4.3" +pathspec = ">=0.9.0" +platformdirs = ">=2" +tomli = {version = ">=1.1.0", markers = "python_full_version < \"3.11.0a7\""} +typing-extensions = {version = ">=3.10.0.0", markers = "python_version < \"3.10\""} + +[package.extras] +colorama = ["colorama (>=0.4.3)"] +d = ["aiohttp (>=3.7.4)"] +jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] +uvloop = ["uvloop (>=0.15.2)"] + +[[package]] +name = "click" +version = "8.1.3" +description = "Composable command line interface toolkit" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "click-8.1.3-py3-none-any.whl", hash = "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"}, + {file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "platform_system == \"Windows\""} + +[[package]] +name = "codespell" +version = "2.2.2" +description = "Codespell" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "codespell-2.2.2-py3-none-any.whl", hash = "sha256:87dfcd9bdc9b3cb8b067b37f0af22044d7a84e28174adfc8eaa203056b7f9ecc"}, + {file = "codespell-2.2.2.tar.gz", hash = "sha256:c4d00c02b5a2a55661f00d5b4b3b5a710fa803ced9a9d7e45438268b099c319c"}, +] + +[package.extras] +dev = ["check-manifest", "flake8", "pytest", "pytest-cov", "pytest-dependency", "tomli"] +hard-encoding-detection = ["chardet"] +toml = ["tomli"] + +[[package]] +name = "colorama" +version = "0.4.6" +description = "Cross-platform colored terminal text." +category = "dev" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +files = [ + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] + +[[package]] +name = "coverage" +version = "6.5.0" +description = "Code coverage measurement for Python" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "coverage-6.5.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:ef8674b0ee8cc11e2d574e3e2998aea5df5ab242e012286824ea3c6970580e53"}, + {file = "coverage-6.5.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:784f53ebc9f3fd0e2a3f6a78b2be1bd1f5575d7863e10c6e12504f240fd06660"}, + {file = "coverage-6.5.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b4a5be1748d538a710f87542f22c2cad22f80545a847ad91ce45e77417293eb4"}, + {file = "coverage-6.5.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:83516205e254a0cb77d2d7bb3632ee019d93d9f4005de31dca0a8c3667d5bc04"}, + {file = "coverage-6.5.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:af4fffaffc4067232253715065e30c5a7ec6faac36f8fc8d6f64263b15f74db0"}, + {file = "coverage-6.5.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:97117225cdd992a9c2a5515db1f66b59db634f59d0679ca1fa3fe8da32749cae"}, + {file = "coverage-6.5.0-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:a1170fa54185845505fbfa672f1c1ab175446c887cce8212c44149581cf2d466"}, + {file = "coverage-6.5.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:11b990d520ea75e7ee8dcab5bc908072aaada194a794db9f6d7d5cfd19661e5a"}, + {file = "coverage-6.5.0-cp310-cp310-win32.whl", hash = "sha256:5dbec3b9095749390c09ab7c89d314727f18800060d8d24e87f01fb9cfb40b32"}, + {file = "coverage-6.5.0-cp310-cp310-win_amd64.whl", hash = "sha256:59f53f1dc5b656cafb1badd0feb428c1e7bc19b867479ff72f7a9dd9b479f10e"}, + {file = "coverage-6.5.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:4a5375e28c5191ac38cca59b38edd33ef4cc914732c916f2929029b4bfb50795"}, + {file = "coverage-6.5.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c4ed2820d919351f4167e52425e096af41bfabacb1857186c1ea32ff9983ed75"}, + {file = "coverage-6.5.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:33a7da4376d5977fbf0a8ed91c4dffaaa8dbf0ddbf4c8eea500a2486d8bc4d7b"}, + {file = "coverage-6.5.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a8fb6cf131ac4070c9c5a3e21de0f7dc5a0fbe8bc77c9456ced896c12fcdad91"}, + {file = "coverage-6.5.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:a6b7d95969b8845250586f269e81e5dfdd8ff828ddeb8567a4a2eaa7313460c4"}, + {file = "coverage-6.5.0-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:1ef221513e6f68b69ee9e159506d583d31aa3567e0ae84eaad9d6ec1107dddaa"}, + {file = "coverage-6.5.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:cca4435eebea7962a52bdb216dec27215d0df64cf27fc1dd538415f5d2b9da6b"}, + {file = "coverage-6.5.0-cp311-cp311-win32.whl", hash = "sha256:98e8a10b7a314f454d9eff4216a9a94d143a7ee65018dd12442e898ee2310578"}, + {file = "coverage-6.5.0-cp311-cp311-win_amd64.whl", hash = "sha256:bc8ef5e043a2af066fa8cbfc6e708d58017024dc4345a1f9757b329a249f041b"}, + {file = "coverage-6.5.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:4433b90fae13f86fafff0b326453dd42fc9a639a0d9e4eec4d366436d1a41b6d"}, + {file = "coverage-6.5.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f4f05d88d9a80ad3cac6244d36dd89a3c00abc16371769f1340101d3cb899fc3"}, + {file = "coverage-6.5.0-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:94e2565443291bd778421856bc975d351738963071e9b8839ca1fc08b42d4bef"}, + {file = "coverage-6.5.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:027018943386e7b942fa832372ebc120155fd970837489896099f5cfa2890f79"}, + {file = "coverage-6.5.0-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:255758a1e3b61db372ec2736c8e2a1fdfaf563977eedbdf131de003ca5779b7d"}, + {file = "coverage-6.5.0-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:851cf4ff24062c6aec510a454b2584f6e998cada52d4cb58c5e233d07172e50c"}, + {file = "coverage-6.5.0-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:12adf310e4aafddc58afdb04d686795f33f4d7a6fa67a7a9d4ce7d6ae24d949f"}, + {file = "coverage-6.5.0-cp37-cp37m-win32.whl", hash = "sha256:b5604380f3415ba69de87a289a2b56687faa4fe04dbee0754bfcae433489316b"}, + {file = "coverage-6.5.0-cp37-cp37m-win_amd64.whl", hash = "sha256:4a8dbc1f0fbb2ae3de73eb0bdbb914180c7abfbf258e90b311dcd4f585d44bd2"}, + {file = "coverage-6.5.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:d900bb429fdfd7f511f868cedd03a6bbb142f3f9118c09b99ef8dc9bf9643c3c"}, + {file = "coverage-6.5.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:2198ea6fc548de52adc826f62cb18554caedfb1d26548c1b7c88d8f7faa8f6ba"}, + {file = "coverage-6.5.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6c4459b3de97b75e3bd6b7d4b7f0db13f17f504f3d13e2a7c623786289dd670e"}, + {file = "coverage-6.5.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:20c8ac5386253717e5ccc827caad43ed66fea0efe255727b1053a8154d952398"}, + {file = "coverage-6.5.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6b07130585d54fe8dff3d97b93b0e20290de974dc8177c320aeaf23459219c0b"}, + {file = "coverage-6.5.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:dbdb91cd8c048c2b09eb17713b0c12a54fbd587d79adcebad543bc0cd9a3410b"}, + {file = "coverage-6.5.0-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:de3001a203182842a4630e7b8d1a2c7c07ec1b45d3084a83d5d227a3806f530f"}, + {file = "coverage-6.5.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:e07f4a4a9b41583d6eabec04f8b68076ab3cd44c20bd29332c6572dda36f372e"}, + {file = "coverage-6.5.0-cp38-cp38-win32.whl", hash = "sha256:6d4817234349a80dbf03640cec6109cd90cba068330703fa65ddf56b60223a6d"}, + {file = "coverage-6.5.0-cp38-cp38-win_amd64.whl", hash = "sha256:7ccf362abd726b0410bf8911c31fbf97f09f8f1061f8c1cf03dfc4b6372848f6"}, + {file = "coverage-6.5.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:633713d70ad6bfc49b34ead4060531658dc6dfc9b3eb7d8a716d5873377ab745"}, + {file = "coverage-6.5.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:95203854f974e07af96358c0b261f1048d8e1083f2de9b1c565e1be4a3a48cfc"}, + {file = "coverage-6.5.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b9023e237f4c02ff739581ef35969c3739445fb059b060ca51771e69101efffe"}, + {file = "coverage-6.5.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:265de0fa6778d07de30bcf4d9dc471c3dc4314a23a3c6603d356a3c9abc2dfcf"}, + {file = "coverage-6.5.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8f830ed581b45b82451a40faabb89c84e1a998124ee4212d440e9c6cf70083e5"}, + {file = "coverage-6.5.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:7b6be138d61e458e18d8e6ddcddd36dd96215edfe5f1168de0b1b32635839b62"}, + {file = "coverage-6.5.0-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:42eafe6778551cf006a7c43153af1211c3aaab658d4d66fa5fcc021613d02518"}, + {file = "coverage-6.5.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:723e8130d4ecc8f56e9a611e73b31219595baa3bb252d539206f7bbbab6ffc1f"}, + {file = "coverage-6.5.0-cp39-cp39-win32.whl", hash = "sha256:d9ecf0829c6a62b9b573c7bb6d4dcd6ba8b6f80be9ba4fc7ed50bf4ac9aecd72"}, + {file = "coverage-6.5.0-cp39-cp39-win_amd64.whl", hash = "sha256:fc2af30ed0d5ae0b1abdb4ebdce598eafd5b35397d4d75deb341a614d333d987"}, + {file = "coverage-6.5.0-pp36.pp37.pp38-none-any.whl", hash = "sha256:1431986dac3923c5945271f169f59c45b8802a114c8f548d611f2015133df77a"}, + {file = "coverage-6.5.0.tar.gz", hash = "sha256:f642e90754ee3e06b0e7e51bce3379590e76b7f76b708e1a71ff043f87025c84"}, +] + +[package.dependencies] +tomli = {version = "*", optional = true, markers = "python_full_version <= \"3.11.0a6\" and extra == \"toml\""} + +[package.extras] +toml = ["tomli"] + +[[package]] +name = "dill" +version = "0.3.6" +description = "serialize all of python" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "dill-0.3.6-py3-none-any.whl", hash = "sha256:a07ffd2351b8c678dfc4a856a3005f8067aea51d6ba6c700796a4d9e280f39f0"}, + {file = "dill-0.3.6.tar.gz", hash = "sha256:e5db55f3687856d8fbdab002ed78544e1c4559a130302693d839dfe8f93f2373"}, +] + +[package.extras] +graph = ["objgraph (>=1.7.2)"] + +[[package]] +name = "exceptiongroup" +version = "1.0.4" +description = "Backport of PEP 654 (exception groups)" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "exceptiongroup-1.0.4-py3-none-any.whl", hash = "sha256:542adf9dea4055530d6e1279602fa5cb11dab2395fa650b8674eaec35fc4a828"}, + {file = "exceptiongroup-1.0.4.tar.gz", hash = "sha256:bd14967b79cd9bdb54d97323216f8fdf533e278df937aa2a90089e7d6e06e5ec"}, +] + +[package.extras] +test = ["pytest (>=6)"] + +[[package]] +name = "flake8" +version = "6.0.0" +description = "the modular source code checker: pep8 pyflakes and co" +category = "main" +optional = false +python-versions = ">=3.8.1" +files = [ + {file = "flake8-6.0.0-py2.py3-none-any.whl", hash = "sha256:3833794e27ff64ea4e9cf5d410082a8b97ff1a06c16aa3d2027339cd0f1195c7"}, + {file = "flake8-6.0.0.tar.gz", hash = "sha256:c61007e76655af75e6785a931f452915b371dc48f56efd765247c8fe68f2b181"}, +] + +[package.dependencies] +mccabe = ">=0.7.0,<0.8.0" +pycodestyle = ">=2.10.0,<2.11.0" +pyflakes = ">=3.0.0,<3.1.0" + +[[package]] +name = "flake8-builtins" +version = "2.1.0" +description = "Check for python builtins being used as variables or parameters." +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "flake8-builtins-2.1.0.tar.gz", hash = "sha256:12ff1ee96dd4e1f3141141ee6c45a5c7d3b3c440d0949e9b8d345c42b39c51d4"}, + {file = "flake8_builtins-2.1.0-py3-none-any.whl", hash = "sha256:469e8f03d6d0edf4b1e62b6d5a97dce4598592c8a13ec8f0952e7a185eba50a1"}, +] + +[package.dependencies] +flake8 = "*" + +[package.extras] +test = ["pytest"] + +[[package]] +name = "flake8-docstrings" +version = "1.6.0" +description = "Extension for flake8 which uses pydocstyle to check docstrings" +category = "dev" +optional = false +python-versions = "*" +files = [ + {file = "flake8-docstrings-1.6.0.tar.gz", hash = "sha256:9fe7c6a306064af8e62a055c2f61e9eb1da55f84bb39caef2b84ce53708ac34b"}, + {file = "flake8_docstrings-1.6.0-py2.py3-none-any.whl", hash = "sha256:99cac583d6c7e32dd28bbfbef120a7c0d1b6dde4adb5a9fd441c4227a6534bde"}, +] + +[package.dependencies] +flake8 = ">=3" +pydocstyle = ">=2.1" + +[[package]] +name = "hypothesis" +version = "6.61.0" +description = "A library for property-based testing" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "hypothesis-6.61.0-py3-none-any.whl", hash = "sha256:7bb22d22e35db99d5724bbf5bdc686b46add94a0f228bf1be249c47ec46b9c7f"}, + {file = "hypothesis-6.61.0.tar.gz", hash = "sha256:fbf7da30aea839d88898f74bcc027f0f997060498a8a7605880688c8a2166215"}, +] + +[package.dependencies] +attrs = ">=19.2.0" +exceptiongroup = {version = ">=1.0.0", markers = "python_version < \"3.11\""} +sortedcontainers = ">=2.1.0,<3.0.0" + +[package.extras] +all = ["backports.zoneinfo (>=0.2.1)", "black (>=19.10b0)", "click (>=7.0)", "django (>=3.2)", "dpcontracts (>=0.4)", "importlib-metadata (>=3.6)", "lark (>=0.10.1)", "libcst (>=0.3.16)", "numpy (>=1.9.0)", "pandas (>=1.0)", "pytest (>=4.6)", "python-dateutil (>=1.4)", "pytz (>=2014.1)", "redis (>=3.0.0)", "rich (>=9.0.0)", "tzdata (>=2022.7)"] +cli = ["black (>=19.10b0)", "click (>=7.0)", "rich (>=9.0.0)"] +codemods = ["libcst (>=0.3.16)"] +dateutil = ["python-dateutil (>=1.4)"] +django = ["django (>=3.2)"] +dpcontracts = ["dpcontracts (>=0.4)"] +ghostwriter = ["black (>=19.10b0)"] +lark = ["lark (>=0.10.1)"] +numpy = ["numpy (>=1.9.0)"] +pandas = ["pandas (>=1.0)"] +pytest = ["pytest (>=4.6)"] +pytz = ["pytz (>=2014.1)"] +redis = ["redis (>=3.0.0)"] +zoneinfo = ["backports.zoneinfo (>=0.2.1)", "tzdata (>=2022.7)"] + +[[package]] +name = "iniconfig" +version = "1.1.1" +description = "iniconfig: brain-dead simple config-ini parsing" +category = "dev" +optional = false +python-versions = "*" +files = [ + {file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"}, + {file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"}, +] + +[[package]] +name = "isort" +version = "5.11.4" +description = "A Python utility / library to sort Python imports." +category = "dev" +optional = false +python-versions = ">=3.7.0" +files = [ + {file = "isort-5.11.4-py3-none-any.whl", hash = "sha256:c033fd0edb91000a7f09527fe5c75321878f98322a77ddcc81adbd83724afb7b"}, + {file = "isort-5.11.4.tar.gz", hash = "sha256:6db30c5ded9815d813932c04c2f85a360bcdd35fed496f4d8f35495ef0a261b6"}, +] + +[package.extras] +colors = ["colorama (>=0.4.3,<0.5.0)"] +pipfile-deprecated-finder = ["pipreqs", "requirementslib"] +plugins = ["setuptools"] +requirements-deprecated-finder = ["pip-api", "pipreqs"] + +[[package]] +name = "lazy-object-proxy" +version = "1.8.0" +description = "A fast and thorough lazy object proxy." +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "lazy-object-proxy-1.8.0.tar.gz", hash = "sha256:c219a00245af0f6fa4e95901ed28044544f50152840c5b6a3e7b2568db34d156"}, + {file = "lazy_object_proxy-1.8.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:4fd031589121ad46e293629b39604031d354043bb5cdf83da4e93c2d7f3389fe"}, + {file = "lazy_object_proxy-1.8.0-cp310-cp310-win32.whl", hash = "sha256:b70d6e7a332eb0217e7872a73926ad4fdc14f846e85ad6749ad111084e76df25"}, + {file = "lazy_object_proxy-1.8.0-cp310-cp310-win_amd64.whl", hash = "sha256:eb329f8d8145379bf5dbe722182410fe8863d186e51bf034d2075eb8d85ee25b"}, + {file = "lazy_object_proxy-1.8.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:4e2d9f764f1befd8bdc97673261b8bb888764dfdbd7a4d8f55e4fbcabb8c3fb7"}, + {file = "lazy_object_proxy-1.8.0-cp311-cp311-win32.whl", hash = "sha256:e20bfa6db17a39c706d24f82df8352488d2943a3b7ce7d4c22579cb89ca8896e"}, + {file = "lazy_object_proxy-1.8.0-cp311-cp311-win_amd64.whl", hash = "sha256:14010b49a2f56ec4943b6cf925f597b534ee2fe1f0738c84b3bce0c1a11ff10d"}, + {file = "lazy_object_proxy-1.8.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:6850e4aeca6d0df35bb06e05c8b934ff7c533734eb51d0ceb2d63696f1e6030c"}, + {file = "lazy_object_proxy-1.8.0-cp37-cp37m-win32.whl", hash = "sha256:5b51d6f3bfeb289dfd4e95de2ecd464cd51982fe6f00e2be1d0bf94864d58acd"}, + {file = "lazy_object_proxy-1.8.0-cp37-cp37m-win_amd64.whl", hash = "sha256:6f593f26c470a379cf7f5bc6db6b5f1722353e7bf937b8d0d0b3fba911998858"}, + {file = "lazy_object_proxy-1.8.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:0c1c7c0433154bb7c54185714c6929acc0ba04ee1b167314a779b9025517eada"}, + {file = "lazy_object_proxy-1.8.0-cp38-cp38-win32.whl", hash = "sha256:d176f392dbbdaacccf15919c77f526edf11a34aece58b55ab58539807b85436f"}, + {file = "lazy_object_proxy-1.8.0-cp38-cp38-win_amd64.whl", hash = "sha256:afcaa24e48bb23b3be31e329deb3f1858f1f1df86aea3d70cb5c8578bfe5261c"}, + {file = "lazy_object_proxy-1.8.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:71d9ae8a82203511a6f60ca5a1b9f8ad201cac0fc75038b2dc5fa519589c9288"}, + {file = "lazy_object_proxy-1.8.0-cp39-cp39-win32.whl", hash = "sha256:8f6ce2118a90efa7f62dd38c7dbfffd42f468b180287b748626293bf12ed468f"}, + {file = "lazy_object_proxy-1.8.0-cp39-cp39-win_amd64.whl", hash = "sha256:eac3a9a5ef13b332c059772fd40b4b1c3d45a3a2b05e33a361dee48e54a4dad0"}, + {file = "lazy_object_proxy-1.8.0-pp37-pypy37_pp73-any.whl", hash = "sha256:ae032743794fba4d171b5b67310d69176287b5bf82a21f588282406a79498891"}, + {file = "lazy_object_proxy-1.8.0-pp38-pypy38_pp73-any.whl", hash = "sha256:7e1561626c49cb394268edd00501b289053a652ed762c58e1081224c8d881cec"}, + {file = "lazy_object_proxy-1.8.0-pp39-pypy39_pp73-any.whl", hash = "sha256:ce58b2b3734c73e68f0e30e4e725264d4d6be95818ec0a0be4bb6bf9a7e79aa8"}, +] + +[[package]] +name = "mccabe" +version = "0.7.0" +description = "McCabe checker, plugin for flake8" +category = "main" +optional = false +python-versions = ">=3.6" +files = [ + {file = "mccabe-0.7.0-py2.py3-none-any.whl", hash = "sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e"}, + {file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"}, +] + +[[package]] +name = "mypy" +version = "0.991" +description = "Optional static typing for Python" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "mypy-0.991-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:7d17e0a9707d0772f4a7b878f04b4fd11f6f5bcb9b3813975a9b13c9332153ab"}, + {file = "mypy-0.991-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:0714258640194d75677e86c786e80ccf294972cc76885d3ebbb560f11db0003d"}, + {file = "mypy-0.991-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:0c8f3be99e8a8bd403caa8c03be619544bc2c77a7093685dcf308c6b109426c6"}, + {file = "mypy-0.991-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bc9ec663ed6c8f15f4ae9d3c04c989b744436c16d26580eaa760ae9dd5d662eb"}, + {file = "mypy-0.991-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:4307270436fd7694b41f913eb09210faff27ea4979ecbcd849e57d2da2f65305"}, + {file = "mypy-0.991-cp310-cp310-win_amd64.whl", hash = "sha256:901c2c269c616e6cb0998b33d4adbb4a6af0ac4ce5cd078afd7bc95830e62c1c"}, + {file = "mypy-0.991-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:d13674f3fb73805ba0c45eb6c0c3053d218aa1f7abead6e446d474529aafc372"}, + {file = "mypy-0.991-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:1c8cd4fb70e8584ca1ed5805cbc7c017a3d1a29fb450621089ffed3e99d1857f"}, + {file = "mypy-0.991-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:209ee89fbb0deed518605edddd234af80506aec932ad28d73c08f1400ef80a33"}, + {file = "mypy-0.991-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:37bd02ebf9d10e05b00d71302d2c2e6ca333e6c2a8584a98c00e038db8121f05"}, + {file = "mypy-0.991-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:26efb2fcc6b67e4d5a55561f39176821d2adf88f2745ddc72751b7890f3194ad"}, + {file = "mypy-0.991-cp311-cp311-win_amd64.whl", hash = "sha256:3a700330b567114b673cf8ee7388e949f843b356a73b5ab22dd7cff4742a5297"}, + {file = "mypy-0.991-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:1f7d1a520373e2272b10796c3ff721ea1a0712288cafaa95931e66aa15798813"}, + {file = "mypy-0.991-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:641411733b127c3e0dab94c45af15fea99e4468f99ac88b39efb1ad677da5711"}, + {file = "mypy-0.991-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:3d80e36b7d7a9259b740be6d8d906221789b0d836201af4234093cae89ced0cd"}, + {file = "mypy-0.991-cp37-cp37m-win_amd64.whl", hash = "sha256:e62ebaad93be3ad1a828a11e90f0e76f15449371ffeecca4a0a0b9adc99abcef"}, + {file = "mypy-0.991-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:b86ce2c1866a748c0f6faca5232059f881cda6dda2a893b9a8373353cfe3715a"}, + {file = "mypy-0.991-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:ac6e503823143464538efda0e8e356d871557ef60ccd38f8824a4257acc18d93"}, + {file = "mypy-0.991-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:0cca5adf694af539aeaa6ac633a7afe9bbd760df9d31be55ab780b77ab5ae8bf"}, + {file = "mypy-0.991-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a12c56bf73cdab116df96e4ff39610b92a348cc99a1307e1da3c3768bbb5b135"}, + {file = "mypy-0.991-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:652b651d42f155033a1967739788c436491b577b6a44e4c39fb340d0ee7f0d70"}, + {file = "mypy-0.991-cp38-cp38-win_amd64.whl", hash = "sha256:4175593dc25d9da12f7de8de873a33f9b2b8bdb4e827a7cae952e5b1a342e243"}, + {file = "mypy-0.991-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:98e781cd35c0acf33eb0295e8b9c55cdbef64fcb35f6d3aa2186f289bed6e80d"}, + {file = "mypy-0.991-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:6d7464bac72a85cb3491c7e92b5b62f3dcccb8af26826257760a552a5e244aa5"}, + {file = "mypy-0.991-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:c9166b3f81a10cdf9b49f2d594b21b31adadb3d5e9db9b834866c3258b695be3"}, + {file = "mypy-0.991-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b8472f736a5bfb159a5e36740847808f6f5b659960115ff29c7cecec1741c648"}, + {file = "mypy-0.991-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5e80e758243b97b618cdf22004beb09e8a2de1af481382e4d84bc52152d1c476"}, + {file = "mypy-0.991-cp39-cp39-win_amd64.whl", hash = "sha256:74e259b5c19f70d35fcc1ad3d56499065c601dfe94ff67ae48b85596b9ec1461"}, + {file = "mypy-0.991-py3-none-any.whl", hash = "sha256:de32edc9b0a7e67c2775e574cb061a537660e51210fbf6006b0b36ea695ae9bb"}, + {file = "mypy-0.991.tar.gz", hash = "sha256:3c0165ba8f354a6d9881809ef29f1a9318a236a6d81c690094c5df32107bde06"}, +] + +[package.dependencies] +mypy-extensions = ">=0.4.3" +tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} +typing-extensions = ">=3.10" + +[package.extras] +dmypy = ["psutil (>=4.0)"] +install-types = ["pip"] +python2 = ["typed-ast (>=1.4.0,<2)"] +reports = ["lxml"] + +[[package]] +name = "mypy-extensions" +version = "0.4.3" +description = "Experimental type system extensions for programs checked with the mypy typechecker." +category = "dev" +optional = false +python-versions = "*" +files = [ + {file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"}, + {file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"}, +] + +[[package]] +name = "packaging" +version = "22.0" +description = "Core utilities for Python packages" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "packaging-22.0-py3-none-any.whl", hash = "sha256:957e2148ba0e1a3b282772e791ef1d8083648bc131c8ab0c1feba110ce1146c3"}, + {file = "packaging-22.0.tar.gz", hash = "sha256:2198ec20bd4c017b8f9717e00f0c8714076fc2fd93816750ab48e2c41de2cfd3"}, +] + +[[package]] +name = "pathspec" +version = "0.10.3" +description = "Utility library for gitignore style pattern matching of file paths." +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pathspec-0.10.3-py3-none-any.whl", hash = "sha256:3c95343af8b756205e2aba76e843ba9520a24dd84f68c22b9f93251507509dd6"}, + {file = "pathspec-0.10.3.tar.gz", hash = "sha256:56200de4077d9d0791465aa9095a01d421861e405b5096955051deefd697d6f6"}, +] + +[[package]] +name = "pep8-naming" +version = "0.13.3" +description = "Check PEP-8 naming conventions, plugin for flake8" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pep8-naming-0.13.3.tar.gz", hash = "sha256:1705f046dfcd851378aac3be1cd1551c7c1e5ff363bacad707d43007877fa971"}, + {file = "pep8_naming-0.13.3-py3-none-any.whl", hash = "sha256:1a86b8c71a03337c97181917e2b472f0f5e4ccb06844a0d6f0a33522549e7a80"}, +] + +[package.dependencies] +flake8 = ">=5.0.0" + +[[package]] +name = "platformdirs" +version = "2.6.0" +description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "platformdirs-2.6.0-py3-none-any.whl", hash = "sha256:1a89a12377800c81983db6be069ec068eee989748799b946cce2a6e80dcc54ca"}, + {file = "platformdirs-2.6.0.tar.gz", hash = "sha256:b46ffafa316e6b83b47489d240ce17173f123a9b9c83282141c3daf26ad9ac2e"}, +] + +[package.extras] +docs = ["furo (>=2022.9.29)", "proselint (>=0.13)", "sphinx (>=5.3)", "sphinx-autodoc-typehints (>=1.19.4)"] +test = ["appdirs (==1.4.4)", "pytest (>=7.2)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] + +[[package]] +name = "pluggy" +version = "1.0.0" +description = "plugin and hook calling mechanisms for python" +category = "dev" +optional = false +python-versions = ">=3.6" +files = [ + {file = "pluggy-1.0.0-py2.py3-none-any.whl", hash = "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"}, + {file = "pluggy-1.0.0.tar.gz", hash = "sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159"}, +] + +[package.extras] +dev = ["pre-commit", "tox"] +testing = ["pytest", "pytest-benchmark"] + +[[package]] +name = "pycodestyle" +version = "2.10.0" +description = "Python style guide checker" +category = "main" +optional = false +python-versions = ">=3.6" +files = [ + {file = "pycodestyle-2.10.0-py2.py3-none-any.whl", hash = "sha256:8a4eaf0d0495c7395bdab3589ac2db602797d76207242c17d470186815706610"}, + {file = "pycodestyle-2.10.0.tar.gz", hash = "sha256:347187bdb476329d98f695c213d7295a846d1152ff4fe9bacb8a9590b8ee7053"}, +] + +[[package]] +name = "pydocstyle" +version = "6.1.1" +description = "Python docstring style checker" +category = "dev" +optional = false +python-versions = ">=3.6" +files = [ + {file = "pydocstyle-6.1.1-py3-none-any.whl", hash = "sha256:6987826d6775056839940041beef5c08cc7e3d71d63149b48e36727f70144dc4"}, + {file = "pydocstyle-6.1.1.tar.gz", hash = "sha256:1d41b7c459ba0ee6c345f2eb9ae827cab14a7533a88c5c6f7e94923f72df92dc"}, +] + +[package.dependencies] +snowballstemmer = "*" + +[package.extras] +toml = ["toml"] + +[[package]] +name = "pyflakes" +version = "3.0.1" +description = "passive checker of Python programs" +category = "main" +optional = false +python-versions = ">=3.6" +files = [ + {file = "pyflakes-3.0.1-py2.py3-none-any.whl", hash = "sha256:ec55bf7fe21fff7f1ad2f7da62363d749e2a470500eab1b555334b67aa1ef8cf"}, + {file = "pyflakes-3.0.1.tar.gz", hash = "sha256:ec8b276a6b60bd80defed25add7e439881c19e64850afd9b346283d4165fd0fd"}, +] + +[[package]] +name = "pylint" +version = "2.15.9" +description = "python code static checker" +category = "dev" +optional = false +python-versions = ">=3.7.2" +files = [ + {file = "pylint-2.15.9-py3-none-any.whl", hash = "sha256:349c8cd36aede4d50a0754a8c0218b43323d13d5d88f4b2952ddfe3e169681eb"}, + {file = "pylint-2.15.9.tar.gz", hash = "sha256:18783cca3cfee5b83c6c5d10b3cdb66c6594520ffae61890858fe8d932e1c6b4"}, +] + +[package.dependencies] +astroid = ">=2.12.13,<=2.14.0-dev0" +colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} +dill = [ + {version = ">=0.2", markers = "python_version < \"3.11\""}, + {version = ">=0.3.6", markers = "python_version >= \"3.11\""}, +] +isort = ">=4.2.5,<6" +mccabe = ">=0.6,<0.8" +platformdirs = ">=2.2.0" +tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} +tomlkit = ">=0.10.1" +typing-extensions = {version = ">=3.10.0", markers = "python_version < \"3.10\""} + +[package.extras] +spelling = ["pyenchant (>=3.2,<4.0)"] +testutils = ["gitpython (>3)"] + +[[package]] +name = "pytest" +version = "7.2.0" +description = "pytest: simple powerful testing with Python" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pytest-7.2.0-py3-none-any.whl", hash = "sha256:892f933d339f068883b6fd5a459f03d85bfcb355e4981e146d2c7616c21fef71"}, + {file = "pytest-7.2.0.tar.gz", hash = "sha256:c4014eb40e10f11f355ad4e3c2fb2c6c6d1919c73f3b5a433de4708202cade59"}, +] + +[package.dependencies] +attrs = ">=19.2.0" +colorama = {version = "*", markers = "sys_platform == \"win32\""} +exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} +iniconfig = "*" +packaging = "*" +pluggy = ">=0.12,<2.0" +tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} + +[package.extras] +testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "xmlschema"] + +[[package]] +name = "pytest-cov" +version = "4.0.0" +description = "Pytest plugin for measuring coverage." +category = "dev" +optional = false +python-versions = ">=3.6" +files = [ + {file = "pytest-cov-4.0.0.tar.gz", hash = "sha256:996b79efde6433cdbd0088872dbc5fb3ed7fe1578b68cdbba634f14bb8dd0470"}, + {file = "pytest_cov-4.0.0-py3-none-any.whl", hash = "sha256:2feb1b751d66a8bd934e5edfa2e961d11309dc37b73b0eabe73b5945fee20f6b"}, +] + +[package.dependencies] +coverage = {version = ">=5.2.1", extras = ["toml"]} +pytest = ">=4.6" + +[package.extras] +testing = ["fields", "hunter", "process-tests", "pytest-xdist", "six", "virtualenv"] + +[[package]] +name = "snowballstemmer" +version = "2.2.0" +description = "This package provides 29 stemmers for 28 languages generated from Snowball algorithms." +category = "dev" +optional = false +python-versions = "*" +files = [ + {file = "snowballstemmer-2.2.0-py2.py3-none-any.whl", hash = "sha256:c8e1716e83cc398ae16824e5572ae04e0d9fc2c6b985fb0f900f5f0c96ecba1a"}, + {file = "snowballstemmer-2.2.0.tar.gz", hash = "sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1"}, +] + +[[package]] +name = "sortedcontainers" +version = "2.4.0" +description = "Sorted Containers -- Sorted List, Sorted Dict, Sorted Set" +category = "dev" +optional = false +python-versions = "*" +files = [ + {file = "sortedcontainers-2.4.0-py2.py3-none-any.whl", hash = "sha256:a163dcaede0f1c021485e957a39245190e74249897e2ae4b2aa38595db237ee0"}, + {file = "sortedcontainers-2.4.0.tar.gz", hash = "sha256:25caa5a06cc30b6b83d11423433f65d1f9d76c4c6a0c90e3379eaa43b9bfdb88"}, +] + +[[package]] +name = "toml" +version = "0.10.2" +description = "Python Library for Tom's Obvious, Minimal Language" +category = "dev" +optional = false +python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" +files = [ + {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, + {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, +] + +[[package]] +name = "tomli" +version = "2.0.1" +description = "A lil' TOML parser" +category = "main" +optional = false +python-versions = ">=3.7" +files = [ + {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, + {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, +] + +[[package]] +name = "tomlkit" +version = "0.11.6" +description = "Style preserving TOML library" +category = "dev" +optional = false +python-versions = ">=3.6" +files = [ + {file = "tomlkit-0.11.6-py3-none-any.whl", hash = "sha256:07de26b0d8cfc18f871aec595fda24d95b08fef89d147caa861939f37230bf4b"}, + {file = "tomlkit-0.11.6.tar.gz", hash = "sha256:71b952e5721688937fb02cf9d354dbcf0785066149d2855e44531ebdd2b65d73"}, +] + +[[package]] +name = "typing-extensions" +version = "4.4.0" +description = "Backported and Experimental Type Hints for Python 3.7+" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "typing_extensions-4.4.0-py3-none-any.whl", hash = "sha256:16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e"}, + {file = "typing_extensions-4.4.0.tar.gz", hash = "sha256:1511434bb92bf8dd198c12b1cc812e800d4181cfcb867674e0f8279cc93087aa"}, +] + +[[package]] +name = "wrapt" +version = "1.14.1" +description = "Module for decorators, wrappers and monkey patching." +category = "dev" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" +files = [ + {file = "wrapt-1.14.1-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:1b376b3f4896e7930f1f772ac4b064ac12598d1c38d04907e696cc4d794b43d3"}, + {file = "wrapt-1.14.1-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:903500616422a40a98a5a3c4ff4ed9d0066f3b4c951fa286018ecdf0750194ef"}, + {file = "wrapt-1.14.1-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:5a9a0d155deafd9448baff28c08e150d9b24ff010e899311ddd63c45c2445e28"}, + {file = "wrapt-1.14.1-cp27-cp27m-manylinux2010_i686.whl", hash = "sha256:ddaea91abf8b0d13443f6dac52e89051a5063c7d014710dcb4d4abb2ff811a59"}, + {file = "wrapt-1.14.1-cp27-cp27m-manylinux2010_x86_64.whl", hash = "sha256:36f582d0c6bc99d5f39cd3ac2a9062e57f3cf606ade29a0a0d6b323462f4dd87"}, + {file = "wrapt-1.14.1-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:7ef58fb89674095bfc57c4069e95d7a31cfdc0939e2a579882ac7d55aadfd2a1"}, + {file = "wrapt-1.14.1-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:e2f83e18fe2f4c9e7db597e988f72712c0c3676d337d8b101f6758107c42425b"}, + {file = "wrapt-1.14.1-cp27-cp27mu-manylinux2010_i686.whl", hash = "sha256:ee2b1b1769f6707a8a445162ea16dddf74285c3964f605877a20e38545c3c462"}, + {file = "wrapt-1.14.1-cp27-cp27mu-manylinux2010_x86_64.whl", hash = "sha256:833b58d5d0b7e5b9832869f039203389ac7cbf01765639c7309fd50ef619e0b1"}, + {file = "wrapt-1.14.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:80bb5c256f1415f747011dc3604b59bc1f91c6e7150bd7db03b19170ee06b320"}, + {file = "wrapt-1.14.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:07f7a7d0f388028b2df1d916e94bbb40624c59b48ecc6cbc232546706fac74c2"}, + {file = "wrapt-1.14.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:02b41b633c6261feff8ddd8d11c711df6842aba629fdd3da10249a53211a72c4"}, + {file = "wrapt-1.14.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2fe803deacd09a233e4762a1adcea5db5d31e6be577a43352936179d14d90069"}, + {file = "wrapt-1.14.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:257fd78c513e0fb5cdbe058c27a0624c9884e735bbd131935fd49e9fe719d310"}, + {file = "wrapt-1.14.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:4fcc4649dc762cddacd193e6b55bc02edca674067f5f98166d7713b193932b7f"}, + {file = "wrapt-1.14.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:11871514607b15cfeb87c547a49bca19fde402f32e2b1c24a632506c0a756656"}, + {file = "wrapt-1.14.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:8ad85f7f4e20964db4daadcab70b47ab05c7c1cf2a7c1e51087bfaa83831854c"}, + {file = "wrapt-1.14.1-cp310-cp310-win32.whl", hash = "sha256:a9a52172be0b5aae932bef82a79ec0a0ce87288c7d132946d645eba03f0ad8a8"}, + {file = "wrapt-1.14.1-cp310-cp310-win_amd64.whl", hash = "sha256:6d323e1554b3d22cfc03cd3243b5bb815a51f5249fdcbb86fda4bf62bab9e164"}, + {file = "wrapt-1.14.1-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:43ca3bbbe97af00f49efb06e352eae40434ca9d915906f77def219b88e85d907"}, + {file = "wrapt-1.14.1-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:6b1a564e6cb69922c7fe3a678b9f9a3c54e72b469875aa8018f18b4d1dd1adf3"}, + {file = "wrapt-1.14.1-cp35-cp35m-manylinux2010_i686.whl", hash = "sha256:00b6d4ea20a906c0ca56d84f93065b398ab74b927a7a3dbd470f6fc503f95dc3"}, + {file = "wrapt-1.14.1-cp35-cp35m-manylinux2010_x86_64.whl", hash = "sha256:a85d2b46be66a71bedde836d9e41859879cc54a2a04fad1191eb50c2066f6e9d"}, + {file = "wrapt-1.14.1-cp35-cp35m-win32.whl", hash = "sha256:dbcda74c67263139358f4d188ae5faae95c30929281bc6866d00573783c422b7"}, + {file = "wrapt-1.14.1-cp35-cp35m-win_amd64.whl", hash = "sha256:b21bb4c09ffabfa0e85e3a6b623e19b80e7acd709b9f91452b8297ace2a8ab00"}, + {file = "wrapt-1.14.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:9e0fd32e0148dd5dea6af5fee42beb949098564cc23211a88d799e434255a1f4"}, + {file = "wrapt-1.14.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9736af4641846491aedb3c3f56b9bc5568d92b0692303b5a305301a95dfd38b1"}, + {file = "wrapt-1.14.1-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:5b02d65b9ccf0ef6c34cba6cf5bf2aab1bb2f49c6090bafeecc9cd81ad4ea1c1"}, + {file = "wrapt-1.14.1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:21ac0156c4b089b330b7666db40feee30a5d52634cc4560e1905d6529a3897ff"}, + {file = "wrapt-1.14.1-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:9f3e6f9e05148ff90002b884fbc2a86bd303ae847e472f44ecc06c2cd2fcdb2d"}, + {file = "wrapt-1.14.1-cp36-cp36m-musllinux_1_1_i686.whl", hash = "sha256:6e743de5e9c3d1b7185870f480587b75b1cb604832e380d64f9504a0535912d1"}, + {file = "wrapt-1.14.1-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:d79d7d5dc8a32b7093e81e97dad755127ff77bcc899e845f41bf71747af0c569"}, + {file = "wrapt-1.14.1-cp36-cp36m-win32.whl", hash = "sha256:81b19725065dcb43df02b37e03278c011a09e49757287dca60c5aecdd5a0b8ed"}, + {file = "wrapt-1.14.1-cp36-cp36m-win_amd64.whl", hash = "sha256:b014c23646a467558be7da3d6b9fa409b2c567d2110599b7cf9a0c5992b3b471"}, + {file = "wrapt-1.14.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:88bd7b6bd70a5b6803c1abf6bca012f7ed963e58c68d76ee20b9d751c74a3248"}, + {file = "wrapt-1.14.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b5901a312f4d14c59918c221323068fad0540e34324925c8475263841dbdfe68"}, + {file = "wrapt-1.14.1-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d77c85fedff92cf788face9bfa3ebaa364448ebb1d765302e9af11bf449ca36d"}, + {file = "wrapt-1.14.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8d649d616e5c6a678b26d15ece345354f7c2286acd6db868e65fcc5ff7c24a77"}, + {file = "wrapt-1.14.1-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:7d2872609603cb35ca513d7404a94d6d608fc13211563571117046c9d2bcc3d7"}, + {file = "wrapt-1.14.1-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:ee6acae74a2b91865910eef5e7de37dc6895ad96fa23603d1d27ea69df545015"}, + {file = "wrapt-1.14.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:2b39d38039a1fdad98c87279b48bc5dce2c0ca0d73483b12cb72aa9609278e8a"}, + {file = "wrapt-1.14.1-cp37-cp37m-win32.whl", hash = "sha256:60db23fa423575eeb65ea430cee741acb7c26a1365d103f7b0f6ec412b893853"}, + {file = "wrapt-1.14.1-cp37-cp37m-win_amd64.whl", hash = "sha256:709fe01086a55cf79d20f741f39325018f4df051ef39fe921b1ebe780a66184c"}, + {file = "wrapt-1.14.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:8c0ce1e99116d5ab21355d8ebe53d9460366704ea38ae4d9f6933188f327b456"}, + {file = "wrapt-1.14.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:e3fb1677c720409d5f671e39bac6c9e0e422584e5f518bfd50aa4cbbea02433f"}, + {file = "wrapt-1.14.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:642c2e7a804fcf18c222e1060df25fc210b9c58db7c91416fb055897fc27e8cc"}, + {file = "wrapt-1.14.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7b7c050ae976e286906dd3f26009e117eb000fb2cf3533398c5ad9ccc86867b1"}, + {file = "wrapt-1.14.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ef3f72c9666bba2bab70d2a8b79f2c6d2c1a42a7f7e2b0ec83bb2f9e383950af"}, + {file = "wrapt-1.14.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:01c205616a89d09827986bc4e859bcabd64f5a0662a7fe95e0d359424e0e071b"}, + {file = "wrapt-1.14.1-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:5a0f54ce2c092aaf439813735584b9537cad479575a09892b8352fea5e988dc0"}, + {file = "wrapt-1.14.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:2cf71233a0ed05ccdabe209c606fe0bac7379fdcf687f39b944420d2a09fdb57"}, + {file = "wrapt-1.14.1-cp38-cp38-win32.whl", hash = "sha256:aa31fdcc33fef9eb2552cbcbfee7773d5a6792c137b359e82879c101e98584c5"}, + {file = "wrapt-1.14.1-cp38-cp38-win_amd64.whl", hash = "sha256:d1967f46ea8f2db647c786e78d8cc7e4313dbd1b0aca360592d8027b8508e24d"}, + {file = "wrapt-1.14.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:3232822c7d98d23895ccc443bbdf57c7412c5a65996c30442ebe6ed3df335383"}, + {file = "wrapt-1.14.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:988635d122aaf2bdcef9e795435662bcd65b02f4f4c1ae37fbee7401c440b3a7"}, + {file = "wrapt-1.14.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9cca3c2cdadb362116235fdbd411735de4328c61425b0aa9f872fd76d02c4e86"}, + {file = "wrapt-1.14.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d52a25136894c63de15a35bc0bdc5adb4b0e173b9c0d07a2be9d3ca64a332735"}, + {file = "wrapt-1.14.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:40e7bc81c9e2b2734ea4bc1aceb8a8f0ceaac7c5299bc5d69e37c44d9081d43b"}, + {file = "wrapt-1.14.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:b9b7a708dd92306328117d8c4b62e2194d00c365f18eff11a9b53c6f923b01e3"}, + {file = "wrapt-1.14.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:6a9a25751acb379b466ff6be78a315e2b439d4c94c1e99cb7266d40a537995d3"}, + {file = "wrapt-1.14.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:34aa51c45f28ba7f12accd624225e2b1e5a3a45206aa191f6f9aac931d9d56fe"}, + {file = "wrapt-1.14.1-cp39-cp39-win32.whl", hash = "sha256:dee0ce50c6a2dd9056c20db781e9c1cfd33e77d2d569f5d1d9321c641bb903d5"}, + {file = "wrapt-1.14.1-cp39-cp39-win_amd64.whl", hash = "sha256:dee60e1de1898bde3b238f18340eec6148986da0455d8ba7848d50470a7a32fb"}, + {file = "wrapt-1.14.1.tar.gz", hash = "sha256:380a85cf89e0e69b7cfbe2ea9f765f004ff419f34194018a6827ac0e3edfed4d"}, +] + +[metadata] +lock-version = "2.0" +python-versions = "^3.8.1" +content-hash = "2dc818517d2071875c5103e50316d4811bcf157989a0f1dab44934d13b9ea1df" diff --git a/poetry.toml b/poetry.toml new file mode 100644 index 0000000..ab1033b --- /dev/null +++ b/poetry.toml @@ -0,0 +1,2 @@ +[virtualenvs] +in-project = true diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..2cfad0d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,68 @@ +[tool.poetry] +name = "flake8-test-docs" +version = "1.0.0" +description = "A linter that checks test docstrings for the arrange/act/assert structure" +authors = ["David Andersson "] +license = "Apache 2.0" +readme = "README.md" +packages = [{include = "flake8_test_docs.py"}] +classifiers = [ + "Framework :: Flake8", + "Environment :: Console", + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.10", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Software Development :: Quality Assurance", +] + +[tool.poetry.dependencies] +python = "^3.8.1" +flake8 = "^6" +tomli = { version = "^2", python = "<3.11" } + +[tool.poetry.group.dev.dependencies] +pytest = "^7" +mypy = "^0.991" +isort = "^5" +black = "^22" +coverage = {extras = ["toml"], version = "^6"} +pytest-cov = "^4" +flake8-docstrings = "^1" +flake8-builtins = "^2" +pep8-naming = "^0" +codespell = "^2" +pylint = "^2" +pydocstyle = "^6" +toml = "^0" +astpretty = "^3" +hypothesis = "^6" + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" + +[tool.poetry.plugins."flake8.extension"] +TDO = "flake8_test_docs:Plugin" + +[tool.black] +line-length = 99 +target-version = ["py38"] + +[tool.isort] +line_length = 99 +profile = "black" +extra_standard_library = ["tomllib"] + +[tool.coverage.run] +branch = true + +[tool.coverage.report] +fail_under = 100 +show_missing = true + +[tool.mypy] +ignore_missing_imports = true diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..17ed406 --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1 @@ +"""Tests for the plugin.""" diff --git a/tests/test_flake8_test_docs_integration.py b/tests/test_flake8_test_docs_integration.py new file mode 100644 index 0000000..d7d1eae --- /dev/null +++ b/tests/test_flake8_test_docs_integration.py @@ -0,0 +1,241 @@ +"""Integration tests for plugin.""" + +import subprocess +import sys +from pathlib import Path + +import pytest + +from flake8_test_docs import ( + INDENT_SIZE_ARN_NAME, + INVALID_CODE, + INVALID_MSG_POSTFIX, + MISSING_CODE, + TEST_DOCS_FILENAME_PATTERN_ARG_NAME, + TEST_DOCS_FUNCTION_PATTERN_ARG_NAME, + TEST_DOCS_PATTERN_ARG_NAME, +) + + +def test_help(): + """ + given: linter + when: the flake8 help message is generated + then: plugin is registered with flake8 + """ + with subprocess.Popen( + f"{sys.executable} -m flake8 --help", + stdout=subprocess.PIPE, + shell=True, + ) as proc: + stdout = proc.communicate()[0].decode(encoding="utf-8") + + assert "flake8-test-docs" in stdout + assert TEST_DOCS_PATTERN_ARG_NAME in stdout + assert TEST_DOCS_FILENAME_PATTERN_ARG_NAME in stdout + assert TEST_DOCS_FUNCTION_PATTERN_ARG_NAME in stdout + assert INDENT_SIZE_ARN_NAME in stdout + + +def create_code_file(code: str, filename: str, base_path: Path) -> Path: + """Create the code file with the given code. + + Args: + code: The code to write to the file. + filename: The name of the file to create. + base_path: The path to create the file within + + Returns: + The path to the code file. + """ + (code_file := base_path / filename).write_text(f'"""Docstring."""\n\n{code}') + return code_file + + +def test_fail(tmp_path: Path): + """ + given: file with Python code that fails the linting + when: flake8 is run against the code + then: the process exits with non-zero code and includes the error message + """ + code_file = create_code_file('\ndef test_():\n """Docstring."""\n', "test_.py", tmp_path) + + with subprocess.Popen( + f"{sys.executable} -m flake8 {code_file}", + stdout=subprocess.PIPE, + shell=True, + ) as proc: + stdout = proc.communicate()[0].decode(encoding="utf-8") + + assert ( + f"{INVALID_CODE} the docstring should start with an empty line{INVALID_MSG_POSTFIX}" + in stdout + ) + assert proc.returncode + + +@pytest.mark.parametrize( + "docs_pattern", + [ + pytest.param("", id="empty"), + pytest.param("given", id="only 1"), + pytest.param("given/when", id="only 2"), + pytest.param("given/when/then/extra", id="4 provided"), + ], +) +def test_invalid_docs_pattern(docs_pattern: str, tmp_path: Path): + """ + given: invalid value for the docs pattern argument + when: flake8 is run against the code + then: the process exits with non-zero code + """ + code = ''' +def test_(): + """ + arrange: line 1 + act: line 2 + assert: line 3 + """ +''' + code_file = create_code_file(code, "test_.py", tmp_path) + + with subprocess.Popen( + f"{sys.executable} -m flake8 {code_file} {TEST_DOCS_PATTERN_ARG_NAME} {docs_pattern}", + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL, + shell=True, + ) as proc: + proc.communicate() + + assert proc.returncode + + +@pytest.mark.parametrize( + "code, filename, extra_args", + [ + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + act: line 2 + assert: line 3 + """ +''', + "test_.py", + "", + id="default", + ), + pytest.param( + ''' +def test_(): + """ + given: line 1 + when: line 2 + then: line 3 + """ +''', + "test_.py", + f"{TEST_DOCS_PATTERN_ARG_NAME} given/when/then", + id="custom docs pattern", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + act: line 2 + assert: line 3 + """ +''', + "_test.py", + f"{TEST_DOCS_FILENAME_PATTERN_ARG_NAME} .*_test.py", + id="custom filename pattern", + ), + pytest.param( + ''' +def _test(): + """ + arrange: line 1 + act: line 2 + assert: line 3 + """ +''', + "test_.py", + f"{TEST_DOCS_FUNCTION_PATTERN_ARG_NAME} .*_test", + id="custom function pattern", + ), + pytest.param( + f""" +def test_(): # noqa: {MISSING_CODE} + pass +""", + "test_.py", + "", + id=f"{MISSING_CODE} disabled", + ), + pytest.param( + f''' +def test_(): + """""" # noqa: {INVALID_CODE} +''', + "test_.py", + "", + id=f"{INVALID_CODE} disabled", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + line 2 + act: line 3 + line 4 + assert: line 5 + line 6 + """ +''', + "test_.py", + "--indent-size 2", + id="changed indentation", + ), + ], +) +def test_pass(code: str, filename: str, extra_args: str, tmp_path: Path): + """ + given: file with Python code that passes the linting + when: flake8 is run against the code + then: the process exits with zero code and empty stdout + """ + code_file = create_code_file(code, filename, tmp_path) + (config_file := tmp_path / ".flake8").touch() + + with subprocess.Popen( + ( + f"{sys.executable} -m flake8 {code_file} {extra_args} --ignore D205,D400,D103 " + f"--config {config_file}" + ), + stdout=subprocess.PIPE, + shell=True, + ) as proc: + stdout = proc.communicate()[0].decode(encoding="utf-8") + + assert not stdout, stdout + assert not proc.returncode + + +def test_self(): + """ + given: working linter + when: flake8 is run against the tests of the linter + then: the process exits with zero code and empty stdout + """ + with subprocess.Popen( + f"{sys.executable} -m flake8 tests/ --ignore D205,D400,D103", + stdout=subprocess.PIPE, + shell=True, + ) as proc: + stdout = proc.communicate()[0].decode(encoding="utf-8") + + assert not stdout, stdout + assert not proc.returncode diff --git a/tests/test_flake8_test_docs_unit.py b/tests/test_flake8_test_docs_unit.py new file mode 100644 index 0000000..068f867 --- /dev/null +++ b/tests/test_flake8_test_docs_unit.py @@ -0,0 +1,860 @@ +"""Unit tests for plugin.""" + +import ast +from typing import Tuple + +import hypothesis +import pytest +from hypothesis import strategies + +from flake8_test_docs import ( + ACT_DESCRIPTION, + ARRANGE_DESCRIPTION, + ASSERT_DESCRIPTION, + INVALID_CODE, + INVALID_MSG_POSTFIX, + MISSING_MSG, + Plugin, +) + + +def _result(code: str, filename: str = "test_.py") -> Tuple[str, ...]: + """Generate linting results. + + Args: + code: The code to check. + + Returns: + The linting result. + """ + tree = ast.parse(code) + plugin = Plugin(tree, filename) + return tuple(f"{line}:{col} {msg}" for line, col, msg, _ in plugin.run()) + + +@pytest.mark.parametrize( + "code, expected_result", + [ + pytest.param("", (), id="trivial"), + pytest.param( + """ +def test_(): + pass +""", + (f"2:0 {MISSING_MSG}",), + id="missing docstring", + ), + pytest.param( + """ +class TestSuite: + def test_(): + pass +""", + (f"3:4 {MISSING_MSG}",), + id="missing docstring deeper nesting", + ), + pytest.param( + ''' +def test_(): + """""" +''', + (f"3:4 {INVALID_CODE} the docstring should not be empty{INVALID_MSG_POSTFIX}",), + id="invalid docstring empty", + ), + pytest.param( + ''' +class TestSuite: + def test_(): + """""" +''', + (f"4:8 {INVALID_CODE} the docstring should not be empty{INVALID_MSG_POSTFIX}",), + id="invalid docstring empty deeper nesting", + ), + pytest.param( + ''' +def test_(): + """arrange""" +''', + ( + f"3:4 {INVALID_CODE} the docstring should start with an empty line" + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring not empty start line", + ), + pytest.param( + ''' +def test_(): + """ + """ +''', + ( + f'3:4 {INVALID_CODE} the docstring should include "arrange" describing the test ' + f"{ARRANGE_DESCRIPTION} on line 1 of the docstring" + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring arrange missing", + ), + pytest.param( + ''' +def test_(): + """ +arrange""" +''', + ( + f"3:4 {INVALID_CODE} the indentation of line 1 of the docstring should match the " + "indentation of the docstring" + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring arrange wrong column offset", + ), + pytest.param( + ''' +def test_(): + """ + +arrange""" +''', + ( + f"3:4 {INVALID_CODE} there should only be a single empty line at the start of " + "the docstring, found an empty line on line 1" + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring arrange extra new line", + ), + pytest.param( + ''' +def test_(): + """ + + +arrange""" +''', + ( + f"3:4 {INVALID_CODE} there should only be a single empty line at the start of the " + "docstring, found an empty line on line 1" + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring arrange many extra new line", + ), + pytest.param( + ''' +def test_(): + """ + given arrange""" +''', + ( + f'3:4 {INVALID_CODE} line 1 of the docstring should start with "arrange:"' + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring arrange wrong word", + ), + pytest.param( + ''' +def test_(): + """ + arrange""" +''', + ( + f'3:4 {INVALID_CODE} line 1 of the docstring should start with "arrange:"' + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring arrange missing colon", + ), + pytest.param( + ''' +def test_(): + """ + arrange:""" +''', + ( + f'3:4 {INVALID_CODE} "arrange:" should be followed by a description of the test ' + f"{ARRANGE_DESCRIPTION} on line 1 of the docstring" + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring arrange no description", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + +line 3""" +''', + ( + f"3:4 {INVALID_CODE} there should not be an empty line in the test " + f"{ARRANGE_DESCRIPTION} description on line 2 of the docstring" + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring arrange wrong newline in description", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 +line 2""" +''', + ( + f"3:4 {INVALID_CODE} test {ARRANGE_DESCRIPTION} description on line 2 should be " + 'indented by 4 more spaces than "arrange:" on line 1' + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring arrange wrong multiline at start", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + line 2""" +''', + ( + f"3:4 {INVALID_CODE} test {ARRANGE_DESCRIPTION} description on line 2 should be " + 'indented by 4 more spaces than "arrange:" on line 1' + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring arrange wrong multiline past column offset + 4", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + line 2 +line 3""" +''', + ( + f"3:4 {INVALID_CODE} test {ARRANGE_DESCRIPTION} description on line 3 should be " + 'indented by 4 more spaces than "arrange:" on line 1' + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring arrange wrong many lines at start", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + """ +''', + ( + f'3:4 {INVALID_CODE} the docstring should include "act" describing the test ' + f"{ACT_DESCRIPTION} on line 2 of the docstring" + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring act missing", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + +act""" +''', + ( + f"3:4 {INVALID_CODE} there should not be an empty line in the test " + f"{ARRANGE_DESCRIPTION} description on line 2 of the docstring" + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring act empty line before", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 +act""" +''', + ( + f"3:4 {INVALID_CODE} the indentation of line 2 of the docstring should match the " + "indentation of the docstring" + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring act wrong column offset", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + line 2 +act""" +''', + ( + f"3:4 {INVALID_CODE} the indentation of line 3 of the docstring should match the " + "indentation of the docstring" + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring act wrong column offset arrange multi line", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + when""" +''', + ( + f'3:4 {INVALID_CODE} the docstring should include "act" describing the test ' + f"{ACT_DESCRIPTION} on line 2 of the docstring" + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring act wrong word", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + when act""" +''', + ( + f'3:4 {INVALID_CODE} line 2 of the docstring should start with "act:"' + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring act wrong start", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + act""" +''', + ( + f'3:4 {INVALID_CODE} line 2 of the docstring should start with "act:"' + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring act missing colon", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + act:""" +''', + ( + f'3:4 {INVALID_CODE} "act:" should be followed by a description of the test ' + f"{ACT_DESCRIPTION} on line 2 of the docstring" + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring act no description", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + act: line 2 + +line 4""" +''', + ( + f"3:4 {INVALID_CODE} there should not be an empty line in the test " + f"{ACT_DESCRIPTION} description on line 3 of the docstring" + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring act wrong newline in description", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + act: line 2 +line 3""" +''', + ( + f"3:4 {INVALID_CODE} test {ACT_DESCRIPTION} description on line 3 should be " + 'indented by 4 more spaces than "act:" on line 2' + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring act wrong multiline at start", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + act: line 2 + line 3 +line 4""" +''', + ( + f"3:4 {INVALID_CODE} test {ACT_DESCRIPTION} description on line 4 should be " + 'indented by 4 more spaces than "act:" on line 2' + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring act wrong many lines at start", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + act: line 2 + """ +''', + ( + f'3:4 {INVALID_CODE} the docstring should include "assert" describing the test ' + f"{ASSERT_DESCRIPTION} on line 3 of the docstring" + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring assert missing", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + act: line 2 +assert""" +''', + ( + f"3:4 {INVALID_CODE} the indentation of line 3 of the docstring should match the " + "indentation of the docstring" + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring assert empty line before", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + act: line 2 +assert""" +''', + ( + f"3:4 {INVALID_CODE} the indentation of line 3 of the docstring should match the " + "indentation of the docstring" + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring assert wrong column offset", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + act: line 2 + line 3 +assert""" +''', + ( + f"3:4 {INVALID_CODE} the indentation of line 4 of the docstring should match the " + "indentation of the docstring" + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring assert wrong column offset act multi line", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + act: line 2 + then""" +''', + ( + f'3:4 {INVALID_CODE} the docstring should include "assert" describing the test ' + f"{ASSERT_DESCRIPTION} on line 3 of the docstring" + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring assert wrong word", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + act: line 2 + then assert""" +''', + ( + f'3:4 {INVALID_CODE} line 3 of the docstring should start with "assert:"' + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring assert wrong start", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + act: line 2 + assert""" +''', + ( + f'3:4 {INVALID_CODE} line 3 of the docstring should start with "assert:"' + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring assert missing colon", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + act: line 2 + assert:""" +''', + ( + f'3:4 {INVALID_CODE} "assert:" should be followed by a description of the test ' + f"{ASSERT_DESCRIPTION} on line 3 of the docstring" + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring assert no description", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + act: line 2 + assert: line 3 + +line 5""" +''', + ( + f"3:4 {INVALID_CODE} there should not be an empty line in the test " + f"{ASSERT_DESCRIPTION} description on line 4 of the docstring" + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring assert wrong newline in description", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + act: line 2 + assert: line 3 +line 4""" +''', + ( + f"3:4 {INVALID_CODE} test {ASSERT_DESCRIPTION} description on line 4 should be " + 'indented by 4 more spaces than "assert:" on line 3' + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring assert wrong multiline at start", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + act: line 2 + assert: line 3 + line 4""" +''', + ( + f"3:4 {INVALID_CODE} the indentation of the last line of the docstring at line 4 " + "should match the indentation of the docstring" + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring assert wrong multiline at docstring column offset", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + act: line 2 + assert: line 3 + line 4 +line 5""" +''', + ( + f"3:4 {INVALID_CODE} test {ASSERT_DESCRIPTION} description on line 5 should be " + 'indented by 4 more spaces than "assert:" on line 3' + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring assert wrong many lines at start", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + act: line 2 + assert: line 3 + line 4 + line 5""" +''', + ( + f"3:4 {INVALID_CODE} the indentation of the last line of the docstring at line 5 " + "should match the indentation of the docstring" + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring assert wrong many lines at docstring column offset", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + act: line 2 + assert: line 3 +""" +''', + ( + f"3:4 {INVALID_CODE} the indentation of the last line of the docstring at line 4 " + "should match the indentation of the docstring" + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring empty newline at end", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + act: line 2 + assert: line 3 + """ +''', + ( + f"3:4 {INVALID_CODE} the indentation of the last line of the docstring at line 4 " + "should match the indentation of the docstring" + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring single space newline at end", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + act: line 2 + assert: line 3 + """ +''', + ( + f"3:4 {INVALID_CODE} the indentation of the last line of the docstring at line 4 " + "should match the indentation of the docstring" + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring ending wrong indent just left", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + act: line 2 + assert: line 3 + """ +''', + ( + f"3:4 {INVALID_CODE} test {ASSERT_DESCRIPTION} description on line 4 should be " + 'indented by 4 more spaces than "assert:" on line 3' + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring ending wrong indent just right", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + act: line 2 + assert: line 3 + """ +''', + ( + f"3:4 {INVALID_CODE} the indentation of the last line of the docstring at line 4 " + "should match the indentation of the docstring" + f"{INVALID_MSG_POSTFIX}", + ), + id="invalid docstring ending wrong indent right", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + act: line 2 + assert: line 3 + """ +''', + (), + id="valid docstring", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + line 2 + act: line 3 + assert: line 4 + """ +''', + (), + id="valid docstring multi line arrange", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + line 2 + line 3 + act: line 4 + assert: line 5 + """ +''', + (), + id="valid docstring many line arrange", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + act: line 2 + line 3 + assert: line 4 + """ +''', + (), + id="valid docstring multi line act", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + act: line 2 + line 3 + line 4 + assert: line 5 + """ +''', + (), + id="valid docstring many line act", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + act: line 2 + assert: line 3 + line 4 + """ +''', + (), + id="valid docstring multi line assert", + ), + pytest.param( + ''' +def test_(): + """ + arrange: line 1 + act: line 2 + assert: line 3 + line 4 + line 5 + """ +''', + (), + id="valid docstring many line assert", + ), + pytest.param( + ''' +class TestSuite: + def test_(): + """ + arrange: line 1 + act: line 2 + assert: line 3 + """ +''', + (), + id="valid docstring deeper indentation", + ), + pytest.param( + """ +def function_1(): + pass +""", + (), + id="missing docstring not test function", + ), + pytest.param( + ''' +def function_1(): + """""" +''', + (), + id="invalid docstring not test function", + ), + ], +) +def test_plugin_invalid(code: str, expected_result: Tuple[str, ...]): + """ + given: code + when: linting is run on the code + then: the expected result is returned + """ + assert _result(code) == expected_result + + +@pytest.mark.parametrize( + "filename, expected_result", + [ + pytest.param("test_.py", (f"2:0 {MISSING_MSG}",), id="test file"), + pytest.param("file.py", (), id="not test file"), + ], +) +def test_plugin_filename(filename: str, expected_result: Tuple[str, ...]): + """ + given: code and filename + when: linting is run on the code + then: the expected result is returned + """ + code = """ +def test_(): + pass +""" + + assert _result(code, filename) == expected_result + + +_TEST_DOCS_SECTION_PREFIX_REGEX = r" " +_TEST_DOCS_WORD_REGEX = r"(\w+ ?)+" +_TEST_DOCS_SECTION_START_REGEX = rf": {_TEST_DOCS_WORD_REGEX}\n" +_TEST_DOCS_OPTIONAL_LINE_REGEX = ( + rf"({_TEST_DOCS_SECTION_PREFIX_REGEX * 2}{_TEST_DOCS_WORD_REGEX}\n)*" +) +_TEST_DOCS_REGEX = ( + f"^\n" + f"{_TEST_DOCS_SECTION_PREFIX_REGEX}arrange{_TEST_DOCS_SECTION_START_REGEX}" + f"{_TEST_DOCS_OPTIONAL_LINE_REGEX}" + f"{_TEST_DOCS_SECTION_PREFIX_REGEX}act{_TEST_DOCS_SECTION_START_REGEX}" + f"{_TEST_DOCS_OPTIONAL_LINE_REGEX}" + f"{_TEST_DOCS_SECTION_PREFIX_REGEX}assert{_TEST_DOCS_SECTION_START_REGEX}" + f"{_TEST_DOCS_OPTIONAL_LINE_REGEX}" + f"{_TEST_DOCS_SECTION_PREFIX_REGEX}$" +) + + +@hypothesis.settings(suppress_health_check=(hypothesis.HealthCheck.too_slow,)) +@hypothesis.given(strategies.from_regex(_TEST_DOCS_REGEX)) +def test_hypothesis(source: str): + """ + given: generated docstring + when: linting is run on the code + then: empty results are returned + """ + code = f''' +def test_(): + """{source}""" +''' + + assert not _result(code) diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..b7ab782 --- /dev/null +++ b/tox.ini @@ -0,0 +1,61 @@ +[tox] +skipsdist=True +envlist = lint, test, coverage-report + +[vars] +src_module = {toxinidir}/flake8_test_docs +src_path = {[vars]src_module}.py +tst_path = {toxinidir}/tests/ +all_path = {[vars]src_path} {[vars]tst_path} + +[testenv] +allowlist_externals=python,poetry +setenv = + PYTHONPATH = {toxinidir}:{toxinidir}/lib:{[vars]src_path} + PYTHONBREAKPOINT=ipdb.set_trace + PY_COLORS=1 +passenv = + PYTHONPATH + +[testenv:fmt] +description = Apply coding style standards to code +deps = + poetry +commands = + poetry install + poetry run isort {[vars]all_path} + poetry run black {[vars]all_path} + +[testenv:lint] +description = Check code against coding style standards +deps = + poetry +commands = + poetry install + poetry run pydocstyle {[vars]src_path} + poetry run codespell {toxinidir} --skip {toxinidir}/.git --skip {toxinidir}/.tox \ + --skip {toxinidir}/.venv --skip {toxinidir}/.mypy_cache + poetry run flake8 {[vars]all_path} + poetry run isort --check-only --diff {[vars]all_path} + poetry run black --check --diff {[vars]all_path} + poetry run mypy {[vars]all_path} + poetry run pylint {[vars]all_path} + poetry run pydocstyle {[vars]src_path} + +[testenv:test] +description = Run tests +deps = + poetry +commands = + poetry install + poetry run coverage run \ + -m pytest -v --tb native -s {posargs} + poetry run coverage report + +[testenv:coverage-report] +description = Create test coverage report +deps = + poetry +commands = + poetry install + poetry run coverage report