【发布时间】:2021-12-22 08:16:21
【问题描述】:
以下是运行tox 时的失败消息。我没有在任何论坛上看到这个确切的错误报告。
这里的任何指导都会有很大帮助。
我在 3.8-slim-buster docker 容器中调用 tox 并安装了所需的依赖项 - pip install tox flake8 black pylint
错误:
File ".tox/lint/lib/python3.6/site-packages/hacking/core.py", line 185
except ImportError, exc:
^
SyntaxError: invalid syntax
During handling of the above exception, another exception occurred:
.tox/lint/lib/python3.6/site-packages/flake8/plugins/manager.py", line 168, in load_plugin
raise failed_to_load
flake8.exceptions.FailedToLoadPlugin: Flake8 failed to load plugin "H000" due to invalid syntax (core.py, line 185).
我的 tox.ini 文件。
[tox]
minversion = 1.8
envlist =
unit
lint
format-check
skipsdist = true
[testenv]
usedevelop = true
basepython = python3
passenv = *
setenv =
COVERAGE_FILE={toxworkdir}/.coverage
PIP_EXTRA_INDEX_URL=https://maven.com/artifactory/api/pypi/simple/
extras =
test
[testenv:unit]
commands =
python -m pytest {posargs}
[testenv:lint]
commands =
python -m flake8
[testenv:format]
commands =
python -m black {toxinidir}
[testenv:format-check]
commands =
python -m black --diff --check {toxinidir}
[testenv:build-dists-local]
usedevelop = false
skip_install = true
commands =
python -m pep517.build \
--source \
--binary \
--out-dir {toxinidir}/dist/ \
{toxinidir}
[testenv:build-dists]
commands =
rm -rfv {toxinidir}/dist/
{[testenv:build-dists-local]commands}
whitelist_externals =
rm
[testenv:publish-dists]
commands =
bash -c '\
twine upload {toxinidir}/dist/*.whl \
-u $TWINE_USERNAME \
-p $TWINE_PASSWORD \
--repository-url $TWINE_REPOSITORY \
'
whitelist_externals =
bash
[flake8]
max-line-length = 100
format = pylint
exclude =
.eggs/
.tox/,
.venv*,
build/,
dist/,
doc/,
#- [H106] Don't put vim configuration in source files.
#- [H203] Use assertIs(Not)None to check for None.
#- [H904] Delay string interpolations at logging calls.
enable-extensions = H106,H203,H904
ignore = E226,E302,E41
[pytest]
testpaths = test/
addopts = -v -rxXs --doctest-modules --cov metarelease --cov-report term-missing --showlocals
norecursedirs = dist doc build .tox .eggs
[coverage:run]
omit =
metarelease/cmd/*
metarelease/shell.py
[coverage:report]
fail_under =
100
【问题讨论】:
-
您安装了不支持 python 3.x 的极旧版本的
hacking
标签: python python-3.x tox flake8