diff options
Diffstat (limited to 'testenv')
-rw-r--r-- | testenv/Dockerfile | 8 | ||||
-rw-r--r-- | testenv/linters/coverage.ini | 2 | ||||
-rw-r--r-- | testenv/linters/eslintrc.yaml (renamed from testenv/eslintrc.yaml) | 0 | ||||
-rw-r--r-- | testenv/linters/flake8.ini | 7 | ||||
-rw-r--r-- | testenv/linters/mypy.ini | 5 | ||||
-rw-r--r-- | testenv/linters/pylint.ini (renamed from testenv/pylintrc) | 26 | ||||
-rw-r--r-- | testenv/linters/vulture-wl.py | 6 | ||||
-rw-r--r-- | testenv/mypy.ini | 5 | ||||
-rw-r--r-- | testenv/requirements.txt | 1 | ||||
-rw-r--r-- | testenv/tox.ini | 32 | ||||
-rw-r--r-- | testenv/vulture-wl.py | 5 |
11 files changed, 52 insertions, 45 deletions
diff --git a/testenv/Dockerfile b/testenv/Dockerfile index 41ec2a73..d958a501 100644 --- a/testenv/Dockerfile +++ b/testenv/Dockerfile @@ -4,17 +4,11 @@ RUN dd if=/dev/zero of=/root/loop.img bs=1024 count=1048576 RUN pacman -Syu --noconfirm \ && pacman -S --noconfirm \ + base \ base-devel \ git \ - patch \ - make \ - fakeroot \ - binutils \ expac \ jshon \ - sudo \ - systemd \ - pkgconf \ && (pacman -Sc --noconfirm || true) RUN useradd -r -d / packer \ diff --git a/testenv/linters/coverage.ini b/testenv/linters/coverage.ini new file mode 100644 index 00000000..413170fe --- /dev/null +++ b/testenv/linters/coverage.ini @@ -0,0 +1,2 @@ +[run] +data_file = testenv/.coverage diff --git a/testenv/eslintrc.yaml b/testenv/linters/eslintrc.yaml index 1e4a1f5b..1e4a1f5b 100644 --- a/testenv/eslintrc.yaml +++ b/testenv/linters/eslintrc.yaml diff --git a/testenv/linters/flake8.ini b/testenv/linters/flake8.ini new file mode 100644 index 00000000..b58aef7a --- /dev/null +++ b/testenv/linters/flake8.ini @@ -0,0 +1,7 @@ +[flake8] +max-line-length = 160 +ignore = W503, E227, E241, E252 +# W503 line break before binary operator +# E227 missing whitespace around bitwise or shift operator +# E241 multiple spaces after +# E252 missing whitespace around parameter equals diff --git a/testenv/linters/mypy.ini b/testenv/linters/mypy.ini new file mode 100644 index 00000000..20e0d3a9 --- /dev/null +++ b/testenv/linters/mypy.ini @@ -0,0 +1,5 @@ +[mypy] +python_version = 3.7 +ignore_missing_imports = true +disallow_untyped_defs = true +strict_optional = true diff --git a/testenv/pylintrc b/testenv/linters/pylint.ini index 3adf052d..c1599884 100644 --- a/testenv/pylintrc +++ b/testenv/linters/pylint.ini @@ -1,11 +1,11 @@ [MASTER] -ignore=.git -extension-pkg-whitelist= +ignore = .git +extension-pkg-whitelist = setproctitle, [DESIGN] -min-public-methods=0 -max-args=10 +min-public-methods = 0 +max-args = 10 [TYPECHECK] ignored-classes= @@ -34,29 +34,29 @@ disable = len-as-condition, [REPORTS] -msg-template={symbol} -- {path}:{line}({obj}): {msg} +msg-template = {symbol} -- {path}:{line}({obj}): {msg} [FORMAT] -max-line-length=160 +max-line-length = 160 [BASIC] # List of builtins function names that should not be used, separated by a comma -bad-functions= +bad-functions = # Regular expression matching correct method names -method-rgx=[a-z_][a-z0-9_]{2,50}$ +method-rgx = [a-z_][a-z0-9_]{2,50}$ # Regular expression matching correct function names -function-rgx=[a-z_][a-z0-9_]{2,50}$ +function-rgx = [a-z_][a-z0-9_]{2,50}$ # Regular expression which should only match correct module level names -const-rgx=([a-zA-Z_][a-zA-Z0-9_]*)$ +const-rgx = ([a-zA-Z_][a-zA-Z0-9_]*)$ # Regular expression which should only match correct argument names -argument-rgx=[a-z_][a-z0-9_]{1,30}$ +argument-rgx = [a-z_][a-z0-9_]{1,30}$ # Regular expression which should only match correct variable names -variable-rgx=[a-z_][a-z0-9_]{1,30}$ +variable-rgx = [a-z_][a-z0-9_]{1,30}$ # Regular expression which should only match correct instance attribute names -attr-rgx=[a-z_][a-z0-9_]{1,30}$ +attr-rgx = [a-z_][a-z0-9_]{1,30}$ diff --git a/testenv/linters/vulture-wl.py b/testenv/linters/vulture-wl.py new file mode 100644 index 00000000..c0835cae --- /dev/null +++ b/testenv/linters/vulture-wl.py @@ -0,0 +1,6 @@ +_MassStorageDeviceInfo.manufacturer +_MassStorageDeviceInfo.product +_MassStorageDeviceInfo.real +_MassStorageDeviceInfo.hw +_MassStorageDeviceInfo.image +fake_rpi.RPi.GPIO diff --git a/testenv/mypy.ini b/testenv/mypy.ini deleted file mode 100644 index df6699a4..00000000 --- a/testenv/mypy.ini +++ /dev/null @@ -1,5 +0,0 @@ -[mypy] -python_version = 3.7 -ignore_missing_imports = True -disallow_untyped_defs = True -strict_optional = True diff --git a/testenv/requirements.txt b/testenv/requirements.txt index afa5cf52..b5dc4511 100644 --- a/testenv/requirements.txt +++ b/testenv/requirements.txt @@ -1,4 +1,5 @@ git+git://github.com/willbuckner/rpi-gpio-development-mock@master#egg=rpi +fake_rpi aiohttp aiofiles passlib diff --git a/testenv/tox.ini b/testenv/tox.ini index 918a086e..937ca213 100644 --- a/testenv/tox.ini +++ b/testenv/tox.ini @@ -1,48 +1,50 @@ [tox] -envlist = flake8, pylint, mypy, vulture, eslint, htmlhint +envlist = flake8, pylint, mypy, vulture, pytest, eslint, htmlhint skipsdist = True [testenv] basepython = python3.7 -changedir = /kvmd +changedir = /src [testenv:flake8] -commands = flake8 --config=testenv/tox.ini kvmd genmap.py +commands = flake8 --config=testenv/linters/flake8.ini kvmd genmap.py tests deps = flake8 flake8-double-quotes -rrequirements.txt [testenv:pylint] -commands = pylint --rcfile=testenv/pylintrc --output-format=colorized --reports=no kvmd genmap.py +commands = pylint --rcfile=testenv/linters/pylint.ini --output-format=colorized --reports=no kvmd genmap.py tests deps = pylint + pytest + pytest-asyncio -rrequirements.txt [testenv:mypy] -commands = mypy --config-file=testenv/mypy.ini --cache-dir=testenv/.mypy_cache kvmd genmap.py +commands = mypy --config-file=testenv/linters/mypy.ini --cache-dir=testenv/.mypy_cache kvmd genmap.py tests deps = mypy -rrequirements.txt [testenv:vulture] -commands = vulture --ignore-names=_format_P --ignore-decorators=@_exposed,@_system_task kvmd genmap.py testenv/vulture-wl.py +commands = vulture --ignore-names=_format_P --ignore-decorators=@_exposed,@_system_task kvmd genmap.py tests testenv/linters/vulture-wl.py deps = vulture -rrequirements.txt +[testenv:pytest] +commands = py.test -vv --cov-config=testenv/linters/coverage.ini --cov-report=term-missing --cov=kvmd tests +deps = + pytest + pytest-cov + pytest-asyncio + -rrequirements.txt + [testenv:eslint] whitelist_externals = eslint -commands = eslint --config=testenv/eslintrc.yaml --color --ext .js web/share/js +commands = eslint --config=testenv/linters/eslintrc.yaml --color --ext .js web/share/js [testenv:htmlhint] whitelist_externals = htmlhint commands = htmlhint web/*.html web/*/*.html - -[flake8] -max-line-length = 160 -# W503 line break before binary operator -# E227 missing whitespace around bitwise or shift operator -# E241 multiple spaces after -# E252 missing whitespace around parameter equals -ignore=W503,E227,E241,E252 diff --git a/testenv/vulture-wl.py b/testenv/vulture-wl.py deleted file mode 100644 index 03e19ef6..00000000 --- a/testenv/vulture-wl.py +++ /dev/null @@ -1,5 +0,0 @@ -manufacturer # unused variable (kvmd/msd.py:58) -product # unused variable (kvmd/msd.py:59) -real # unused variable (kvmd/msd.py:71) -hw # unused variable (kvmd/msd.py:73) -image # unused variable (kvmd/msd.py:74) |