1
0
mirror of https://github.com/enpaul/keyosk.git synced 2024-11-24 23:47:49 +00:00

Add static analysis for tests to toxfile

This commit is contained in:
Ethan Paul 2020-03-09 00:32:25 -04:00
parent e3de950147
commit f9d93c0880
4 changed files with 20 additions and 4 deletions

View File

@ -1,9 +1,9 @@
import contextlib import contextlib
import datetime import datetime
import _pytest
import passlib.hash import passlib.hash
import pytest import pytest
import _pytest # noreorder
from keyosk import config from keyosk import config
from keyosk import database from keyosk import database
@ -30,6 +30,7 @@ def sqlite_database(tmp_path):
sqlite_path.unlink() sqlite_path.unlink()
# pylint: disable=too-many-locals
@pytest.fixture(scope="module") @pytest.fixture(scope="module")
def demo_database(request, tmp_path_factory): def demo_database(request, tmp_path_factory):
"""Generate a database with test data in it for tests""" """Generate a database with test data in it for tests"""

View File

@ -1,3 +1,4 @@
# pylint: disable=unused-argument,redefined-outer-name,unused-import
import copy import copy
import passlib import passlib

View File

@ -1,3 +1,4 @@
# pylint: disable=unused-argument,redefined-outer-name,unused-import
import copy import copy
import datetime import datetime

19
tox.ini
View File

@ -1,5 +1,5 @@
[tox] [tox]
envlist = py36, py37, py38, format, static, docs envlist = py36, py37, py38, format, static, static-tests, docs
skip_missing_interpreters = true skip_missing_interpreters = true
isolated_build = true isolated_build = true
@ -16,7 +16,7 @@ commands =
pytest --cov={envsitepackagesdir}/keyosk --cov-config .coveragerc tests/ --cov-report term-missing pytest --cov={envsitepackagesdir}/keyosk --cov-config .coveragerc tests/ --cov-report term-missing
[testenv:format] [testenv:format]
description = Enforce code formatting (pre-commit) description = Enforce file formatting (pre-commit)
skip_install = true skip_install = true
deps = deps =
pre-commit == 2.1.0 pre-commit == 2.1.0
@ -25,7 +25,6 @@ commands =
[testenv:static] [testenv:static]
description = Static code analysis (mypy+pylint+bandit) description = Static code analysis (mypy+pylint+bandit)
skip_install = true
ignore_errors = true ignore_errors = true
deps = deps =
pylint == 2.3.1 pylint == 2.3.1
@ -37,6 +36,20 @@ commands =
pylint keyosk --rcfile .pylintrc pylint keyosk --rcfile .pylintrc
bandit --recursive keyosk bandit --recursive keyosk
[testenv:static-tests]
description = Static code analysis for the tests (mypy+pylint+bandit)
ignore_errors = true
deps =
pytest == 5.3.5
pylint == 2.3.1
astroid == 2.2.5
mypy == 0.761
bandit == 1.6.2
commands =
mypy tests --ignore-missing-imports --no-strict-optional
pylint tests --rcfile .pylintrc
bandit --recursive tests --skip B101
[testenv:docs] [testenv:docs]
description = Build documentation (sphinx) description = Build documentation (sphinx)
deps = deps =