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

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

import_forbidden_from =
    scripts
    user_settings
    notebooks

notebook_allowed_in =
    notebooks

init_forbidden_in =
    scripts
    notebooks

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.1.16.tar.gz (9.8 kB view hashes)

Uploaded Source

Built Distribution

pytest_alphamoon-0.1.16-py3-none-any.whl (12.1 kB view hashes)

Uploaded Python 3

Supported by

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