testing

Configuration for testing and code formatting tools.

Classes:

ToxConfig(repo_path, templates)

Generates the tox.ini configuration file.

Functions:

ensure_tests_requirements(repo_path, templates)

Ensure tests/requirements.txt contains the required entries.

make_formate_toml(repo_path, templates)

Add configuration for formate.

make_isort(repo_path, templates)

Remove the isort configuration file.

make_justfile(repo_path, templates)

Add configuration for just.

make_tox(repo_path, templates)

Add configuration for Tox.

make_yapf(repo_path, templates)

Add configuration for yapf.

class ToxConfig(repo_path, templates)[source]

Bases: IniConfigurator

Generates the tox.ini configuration file.

Parameters
  • repo_path (Path) – Path to the repository root.

  • templates (Environment)

Methods:

__getitem__(item)

Passthrough to templates.globals.

check_wheel_contents()

[check-wheel-contents].

coverage_report()

[coverage:report].

coverage_run()

[coverage:run].

envlists()

[envlists].

flake8()

[flake8].

get_mypy_commands()

Compile the list of mypy commands.

get_mypy_dependencies()

Compile the list of mypy dependencies.

get_source_files()

Compile the list of source files.

get_third_party_version_matrix()

Returns information about the matrix of third party versions.

merge_existing(ini_file)

Merge existing sections in the configuration file into the new configuration.

pytest()

[pytest].

testenv()

[testenv].

testenv_build()

[testenv:build].

testenv_coverage()

[testenv:coverage].

testenv_docs()

[testenv:docs].

testenv_lint()

[testenv:lint].

testenv_mypy()

[testenv:mypy].

testenv_perflint()

[testenv:perflint].

testenv_pyup()

[testenv:pyup].

tox()

[tox].

__getitem__(item)[source]

Passthrough to templates.globals.

Parameters

item (str)

Return type

Any

check_wheel_contents()[source]

[check-wheel-contents].

coverage_report()[source]

[coverage:report].

coverage_run()[source]

[coverage:run].

envlists()[source]

[envlists].

flake8()[source]

[flake8].

get_mypy_commands()[source]

Compile the list of mypy commands.

Return type

List[str]

get_mypy_dependencies()[source]

Compile the list of mypy dependencies.

Return type

List[str]

get_source_files()[source]

Compile the list of source files.

Return type

List[str]

get_third_party_version_matrix()[source]

Returns information about the matrix of third party versions.

The returned object is a three-element tuple, comprising:

  • The name of the third party library.

  • A list of version strings.

  • The testenv suffix, e.g. -attrs{19.3,20.1}.

Return type

Tuple[str, DelimitedList, str]

merge_existing(ini_file)[source]

Merge existing sections in the configuration file into the new configuration.

Parameters

ini_file – The existing .ini file.

pytest()[source]

[pytest].

testenv()[source]

[testenv].

testenv_build()[source]

[testenv:build].

testenv_coverage()[source]

[testenv:coverage].

testenv_docs()[source]

[testenv:docs].

testenv_lint()[source]

[testenv:lint].

testenv_mypy()[source]

[testenv:mypy].

testenv_perflint()[source]

[testenv:perflint].

testenv_pyup()[source]

[testenv:pyup].

tox()[source]

[tox].

ensure_tests_requirements(repo_path, templates)[source]

Ensure tests/requirements.txt contains the required entries.

Parameters
  • repo_path (Path) – Path to the repository root.

  • templates (Environment)

Return type

List[str]

make_formate_toml(repo_path, templates)[source]

Add configuration for formate.

https://formate.readthedocs.io

Parameters
  • repo_path (Path) – Path to the repository root.

  • templates (Environment)

Return type

List[str]

make_isort(repo_path, templates)[source]

Remove the isort configuration file.

https://github.com/timothycrosley/isort

Parameters
  • repo_path (Path) – Path to the repository root.

  • templates (Environment)

Return type

List[str]

make_justfile(repo_path, templates)[source]

Add configuration for just.

https://github.com/casey/just

Parameters
  • repo_path (Path) – Path to the repository root.

  • templates (Environment)

Return type

List[str]

make_tox(repo_path, templates)[source]

Add configuration for Tox.

https://tox.readthedocs.io

Parameters
  • repo_path (Path) – Path to the repository root.

  • templates (Environment)

Return type

List[str]

make_yapf(repo_path, templates)[source]

Add configuration for yapf.

https://github.com/google/yapf

Parameters
  • repo_path (Path) – Path to the repository root.

  • templates (Environment)

Return type

List[str]