Below is the failure message on running tox
. I don't see this exact error reported on any forum.
Any guidance here would be of great help.
I'm invoking the tox in 3.8-slim-buster
docker container & installed the required dependencies - pip install tox flake8 black pylint
Error:
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).
my tox.ini file.
[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
CodePudding user response:
This is neither a flake8
nor a tox
bug, but a bug in hacking
, which you will notice when you have a close look at the traceback.
The syntax
File ".tox/lint/lib/python3.6/site-packages/hacking/core.py", line 185
except ImportError, exc:
is only valid in Python 2, but you use Python 3.
I never heard of the hacking
project before, but using a search engine revealed https://pypi.org/project/hacking/
You should report a bug a their bug tracker.