-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
884 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v2.5.0 | ||
hooks: | ||
- id: check-yaml | ||
- id: check-toml | ||
- id: fix-encoding-pragma | ||
- repo: https://github.com/psf/black | ||
rev: 19.10b0 | ||
hooks: | ||
- id: black | ||
- repo: local | ||
hooks: | ||
- id: flynt | ||
name: flynt | ||
entry: flynt | ||
args: [--fail-on-change] | ||
types: [python] | ||
language: python | ||
additional_dependencies: | ||
- flynt | ||
#- repo: local | ||
# hooks: | ||
# - id: isort | ||
# name: run isort | ||
# entry: isort | ||
# args: [-yq] | ||
# language: python | ||
# additional_dependencies: | ||
# - isort | ||
# - toml | ||
#- repo: local | ||
# hooks: | ||
# - id: tests | ||
# name: run tests | ||
# entry: pytest -s | ||
# language: python | ||
# types: [python] | ||
# stages: [push] | ||
# additional_dependencies: | ||
# - pytest | ||
# - pytest-cov | ||
#- repo: local | ||
# hooks: | ||
# - id: pydocstyle | ||
# name: pydocstyle | ||
# description: 'Check for adherence to python docstring conventions.' | ||
# entry: pydocstyle | ||
# language: python | ||
# types: [python] | ||
# additional_dependencies: | ||
# - pydocstyle | ||
#- repo: https://github.com/pre-commit/mirrors-pylint | ||
# rev: v2.5.2 | ||
# hooks: | ||
# - id: pylint | ||
#- repo: local | ||
# hooks: | ||
# - id: bandit | ||
# name: bandit | ||
# description: 'Find common security issues in Python code' | ||
# entry: bandit | ||
# language: python | ||
# types: [python] | ||
#- repo: local | ||
# hooks: | ||
# - id: poetry-dynamic-versioning | ||
# name: update version from SCM tags | ||
# entry: poetry-dynamic-versioning | ||
# always_run: true | ||
# exclude: .* | ||
# language: python | ||
# additional_dependencies: | ||
# - poetry-dynamic-versioning |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
sudo: false | ||
language: python | ||
python: | ||
- '3.7' | ||
- '3.8' | ||
before_install: | ||
- pip install poetry | ||
install: | ||
- poetry install -v | ||
script: | ||
- poetry run pytest -s | ||
- poetry run nox -s tests | ||
after_success: | ||
- bash <(curl -s https://codecov.io/bash) -X gcov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# -*- coding: utf-8 -*- | ||
"""Nox testing environment defs.""" | ||
# cribbed from https://cjolowicz.github.io/posts/hypermodern-python-03-linting/ | ||
|
||
# standard library imports | ||
import tempfile | ||
|
||
# third-party imports | ||
import nox | ||
|
||
CODE_LOCATIONS = ( | ||
"pytest_datadir_mgr", | ||
"tests", | ||
"noxfile.py", | ||
) | ||
|
||
|
||
def install_with_constraints(session, *args, **kwargs): | ||
"""Get dependencies from poetry.""" | ||
with tempfile.NamedTemporaryFile() as requirements: | ||
session.run( | ||
"poetry", | ||
"export", | ||
"--dev", | ||
"--format=requirements.txt", | ||
f"--output={requirements.name}", | ||
external=True, | ||
) | ||
session.install(f"--constraint={requirements.name}", *args, **kwargs) | ||
|
||
|
||
@nox.session(python=["3.8"]) | ||
def tests(session): | ||
"""Run tests with pytest and pytest-cov.""" | ||
args = session.posargs or ["--cov"] | ||
session.run("poetry", "install", "--no-dev", external=True) | ||
install_with_constraints(session, "coverage[toml]", "pytest", "pytest-cov") | ||
session.run("pytest", *args) | ||
|
||
|
||
@nox.session(python=["3.8"]) | ||
def lint_pylint(session): | ||
"""Run lint on all code.""" | ||
args = session.posargs or CODE_LOCATIONS | ||
session.run("poetry", "install", "--no-dev", external=True) | ||
install_with_constraints(session, "pylint", "nox") | ||
session.run("pylint", *args) |
Oops, something went wrong.