mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 00:51:53 +08:00
validators, tests
This commit is contained in:
@@ -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 \
|
||||
|
||||
2
testenv/linters/coverage.ini
Normal file
2
testenv/linters/coverage.ini
Normal file
@@ -0,0 +1,2 @@
|
||||
[run]
|
||||
data_file = testenv/.coverage
|
||||
7
testenv/linters/flake8.ini
Normal file
7
testenv/linters/flake8.ini
Normal file
@@ -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
|
||||
5
testenv/linters/mypy.ini
Normal file
5
testenv/linters/mypy.ini
Normal file
@@ -0,0 +1,5 @@
|
||||
[mypy]
|
||||
python_version = 3.7
|
||||
ignore_missing_imports = true
|
||||
disallow_untyped_defs = true
|
||||
strict_optional = true
|
||||
@@ -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}$
|
||||
6
testenv/linters/vulture-wl.py
Normal file
6
testenv/linters/vulture-wl.py
Normal file
@@ -0,0 +1,6 @@
|
||||
_MassStorageDeviceInfo.manufacturer
|
||||
_MassStorageDeviceInfo.product
|
||||
_MassStorageDeviceInfo.real
|
||||
_MassStorageDeviceInfo.hw
|
||||
_MassStorageDeviceInfo.image
|
||||
fake_rpi.RPi.GPIO
|
||||
@@ -1,5 +0,0 @@
|
||||
[mypy]
|
||||
python_version = 3.7
|
||||
ignore_missing_imports = True
|
||||
disallow_untyped_defs = True
|
||||
strict_optional = True
|
||||
@@ -1,4 +1,5 @@
|
||||
git+git://github.com/willbuckner/rpi-gpio-development-mock@master#egg=rpi
|
||||
fake_rpi
|
||||
aiohttp
|
||||
aiofiles
|
||||
passlib
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
Reference in New Issue
Block a user