Skip to main content

Static code checks used at Alphamoon

Project description

pytest-alphamoon

image image

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

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.

Project details


Download files

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

Source Distribution

pytest-alphamoon-0.5.1.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

pytest_alphamoon-0.5.1-py3-none-any.whl (21.8 kB view details)

Uploaded Python 3

File details

Details for the file pytest-alphamoon-0.5.1.tar.gz.

File metadata

  • Download URL: pytest-alphamoon-0.5.1.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

File hashes

Hashes for pytest-alphamoon-0.5.1.tar.gz
Algorithm Hash digest
SHA256 2d1c80b43f30d88642aa430ca9ef0481127e12b07e9d2efc28e07b756a27d8b2
MD5 d8889fe0c85fe17c0a4fd5273744b819
BLAKE2b-256 c7976f4ba70096ea5849f2b2eafca737b7aced30a0826499f488f740abbfb86f

See more details on using hashes here.

File details

Details for the file pytest_alphamoon-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: pytest_alphamoon-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 21.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

File hashes

Hashes for pytest_alphamoon-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5c611e8954727e29787f74ecdb21930c15e6e4190d83eab9bf09f82de860cfca
MD5 48b59207ca057b57c07d64ab6e706e0e
BLAKE2b-256 b3b77358b637e6699cd67ba83c5d5154d2a208f79c2b282cf53bfad0716906ce

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page