pytest-alphamoon
Set of simple static code checks at Alphamoon.
This pytest plugin was generated with Cookiecutter along with @hackebrot's cookiecutter-pytest-plugin template. Source code is based on pytest-isort plugin.
Features
Package contains several plugins, as shown in Table below:
| Plugin | Description |
|---|---|
| import-check | Checks no imports from scripts/notebooks/user_settings |
| init-check | Checks no __init__.py file in scripts/notebooks |
| notebook-check | Checks notebooks (.ipnyb files) are clean, without outputs |
| newline-check | Checks files (requirements*, .gitignore or custom) for newline at the end of file |
| testdir-check | Checks test files (files matching patterns: test_*.py or *_test.py) are under /tests directory |
| annotation-check | Checks integration tests function/class definition (all class and functions defined under integration_tests prefixed with test*) has decorator @integration_test |
| adr-check | Checks Architecture Decision Record files has consistent (unique) numbering (by default plugin searches for .adr-dir for declaration of ADR files directory) |
| requirements-coherence-check | Checks requirements defined in setup.py against those in requirements[-dev].txt (library names presence and versions if specified). |
| requirements-versions-check | Checks whether requirements versions are fixed |
| sorted-requirements-check | Checks if requirements* files are sorted |
| commit-message-check | Checks whether git commit messages follow the naming convention |
Requirements
git-python>=1.0.3
pytest>=3.5.0
Installation
You can install "pytest-alphamoon" via pip from PyPI:
$ pip install pytest-alphamoon
Usage
You can add arbitrary plugin from this package by specifying its name in pytest.ini addopts
section with plugin names as shown in Table above along with any other plugin you are currently using.
[pytest]
addopts = --init-check --import-check --notebook-check --newline-check --testdir-check
--annotation-check --adr-check --requirements-coherence-check --requirements-versions-check
--sorted-requirements-check --commit-message-check
import_forbidden_from =
scripts
user_settings
notebooks
notebook_allowed_in =
notebooks
init_forbidden_in =
scripts
notebooks
adr_rel_path = .adr-dir
requirements_path=
requirements.txt
requirements-dev.txt
check_commit_messages_from = 0f95a3b033d27e1845b85ff59739889043fd598d
pytest_nesting_level = 1
Parameters, like import_forbidden_from, shown in example configuration above are optional.
If custom values are not provided in pytest.ini file, default parameters are used.
After setting up configuration file specified checks are loaded and executed automatically within test session, after invoking command:
$ pytest
Contributing
Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.
License
Distributed under the terms of the MIT license, "pytest-alphamoon" is free and open source software
Issues
If you encounter any problems, please email us at dev@alphamoon.ai, along with a detailed description.
Release files for pytest-alphamoon 2021.12.30.1308
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_alphamoon-2021.12.30.1308-py3-none-any.whl | Python 3 | none | any | Details |
Release files / pytest_alphamoon-2021.12.30.1308-py3-none-any.whl
| Download URL | pytest_alphamoon-2021.12.30.1308-py3-none-any.whl |
|---|---|
| Size | 22.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4918b6728c82c3417e306734aee22ab58812422d07aa8aaf14d89a658ecf9588
|
|
BLAKE2b-256 checksum How to use checksums |
d43a2e10417471ea4a51f133b65d18a41fac16eed6e40cac3dc362008e02ef06
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1
|