Lint the integration tests with Python 3

The integration tests under 'tests/integration' are Python 3 only.
Flake8 will fail on Python 3 syntax when running under Python 2, but for
now we wouldn't like to change this, in order to keep Python 2
compatibility of the code base.

To work around the above, set up a separate tox environment to lint the
integration tests, and exclude linting the integration tests when the
rest of the code is checked.

Signed-off-by: Hunor Csomortáni <csomh@redhat.com>
This commit is contained in:
Hunor Csomortáni
2019-11-06 16:48:42 +01:00
parent f24cd4222f
commit 8c0521cde3
2 changed files with 13 additions and 9 deletions

View File

@@ -22,4 +22,4 @@ sed -i \
# Since tox seems to ignore `usedevelop` when we have `sitepackages` on, we have to run it manually
python3 setup.py develop --no-deps
/usr/bin/tox -e flake8,py3 "$@"
/usr/bin/tox -e flake8,py3,intflake "$@"

20
tox.ini
View File

@@ -4,17 +4,12 @@
# and then run "tox" from this directory.
[tox]
envlist = flake8, py27, py3
envlist = flake8, intflake, py27, py3
[flake8]
ignore = E731,W503
max-line-length = 100
exclude =
./.tox
./.git
./module_build_service/migrations
./build
./.env
exclude = .tox,.git,module_build_service/migrations,build,.env
[testenv]
usedevelop = true
@@ -49,7 +44,16 @@ commands =
basepython = python2
skip_install = true
deps = flake8
commands = flake8
# doing this until --extend-exclude support becomes available
# https://flake8.readthedocs.io/en/latest/user/options.html#cmdoption-flake8-extend-exclude
commands = flake8 --exclude={[flake8]exclude},tests/integration
[testenv:intflake]
basepython = python3
skip_install = true
sitepackages = false
deps = flake8
commands = flake8 tests/integration
[testenv:bandit]
basepython = python2