From cede73825a78a8de8e9dbec025865531d41c4a5e Mon Sep 17 00:00:00 2001 From: lukken <lukken@astron.nl> Date: Tue, 22 Feb 2022 11:36:25 +0000 Subject: [PATCH] L2SS-627: Update minimal python version In addition this patch prepares our tox.ini for tox version 4 by better preventing system wide binary access using tox built in variables. --- tangostationcontrol/setup.cfg | 3 +- tangostationcontrol/tox.ini | 61 +++++++++++++++++------------------ 2 files changed, 30 insertions(+), 34 deletions(-) diff --git a/tangostationcontrol/setup.cfg b/tangostationcontrol/setup.cfg index ccbd782a1..99960c1ba 100644 --- a/tangostationcontrol/setup.cfg +++ b/tangostationcontrol/setup.cfg @@ -17,7 +17,6 @@ classifier = Operating System :: POSIX :: Linux Programming Language :: Python Programming Language :: Python :: 3 - Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 @@ -27,7 +26,7 @@ classifier = package_dir= =./ packages=find: -python_requires = >=3.6 +python_requires = >=3.7 [options.packages.find] where=./ diff --git a/tangostationcontrol/tox.ini b/tangostationcontrol/tox.ini index fecac5884..97d91f8b0 100644 --- a/tangostationcontrol/tox.ini +++ b/tangostationcontrol/tox.ini @@ -1,23 +1,29 @@ [tox] -minversion = 2.0 -envlist = py36,py37,py38,py39,py310,pep8 +minversion = 3.20 +envlist = py37,py38,py39,py310,pep8 skipsdist = True [testenv] usedevelop = True +; Module access is a bit of an ugly hack. This is due to testenv inheritance +; with sitepackages = True`, meaning that global packages can be accessed by the +; tox environment. Our tango images already have several dependencies system +; wide installed, however, the system wide installation will never look inside +; tox its virtualenv for packages. So accessing stestr and others fail.. We +; can't remove `sitepackages = True` either as we need access to tango and +; installing this package is non-trivial. The solution is to prevent calling +; binaries directly and utilizing python and tox variables to resolve the +; requested module. sitepackages = True -install_command = pip3 install {opts} {packages} +install_command = {envbindir}/pip3 install {opts} {packages} passenv = HOME setenv = VIRTUAL_ENV={envdir} PYTHONWARNINGS=default::DeprecationWarning - OS_STDOUT_CAPTURE=1 - OS_STDERR_CAPTURE=1 - OS_TEST_TIMEOUT=60 deps = -r{toxinidir}/../docker-compose/lofar-device-base/lofar-requirements.txt -r{toxinidir}/test-requirements.txt -commands = stestr run {posargs} +commands = {envpython} -m stestr run {posargs} [testenv:integration] ; Warning running integration tests will make changes to your docker system! @@ -25,39 +31,30 @@ commands = stestr run {posargs} passenv = TANGO_HOST setenv = TESTS_DIR=./tangostationcontrol/integration_test/{posargs} commands = - stestr run --serial + {envpython} -m stestr run --serial -; The access to coverage as module is a bit of an ugly hack. This is due to -; cover inheriting testenv which has `sitepackages = True`, meaning that global -; packages can be accessed by the tox environment. Our tango images already have -; coverage system wide installed, however, the system wide installation will -; never look inside tox its virtualenv for packages. So accessing stestr and -; others fail.. We can't remove `sitepackages = True` either as we need access -; to tango and installing this package is non-trivial. The solution is to -; prevent calling binaries directly and utilizing python to resolve the -; requested module. In addition stestr does not natively support generating -; coverage reports which is where the `PYTHON=python -m coverage run....` comes -; from. [testenv:cover] +; stestr does not natively support generating coverage reports use +; `PYTHON=python -m coverage run....` to overcome this. setenv = VIRTUAL_ENV={envdir} - PYTHON=python -m coverage run --source tangostationcontrol --parallel-mode + PYTHON={envpython} -m coverage run --source tangostationcontrol --parallel-mode deps = - -r{toxinidir}/test-requirements.txt -r{toxinidir}/../docker-compose/lofar-device-base/lofar-requirements.txt + -r{toxinidir}/test-requirements.txt commands = - python -m coverage erase - stestr run {posargs} - python -m coverage combine - python -m coverage html -d cover - python -m coverage xml -o coverage.xml - python -m coverage report + {envpython} -m coverage erase + {envpython} -m stestr run {posargs} + {envpython} -m coverage combine + {envpython} -m coverage html -d cover + {envpython} -m coverage xml -o coverage.xml + {envpython} -m coverage report ; TODO(Corne): Integrate Hacking to customize pep8 rules [testenv:pep8] commands = - doc8 docs/source/ --ignore D001 - flake8 + {envpython} -m doc8 docs/source/ --ignore D001 + {envpython} -m flake8 [testenv:bandit]; ; B104: hardcoded_bind_all_interfaces @@ -65,18 +62,18 @@ commands = ; It thus matters what interfaces Docker will bind our ; containers to, not what our containers listen on. commands = - bandit -r devices/ -n5 -ll -s B104 + {envpython} -m bandit -r devices/ -n5 -ll -s B104 [testenv:xenon]; commands = - xenon tangostationcontrol -b B -m A -a A + {envpython} -m xenon tangostationcontrol -b B -m A -a A [testenv:docs] deps = -r{toxinidir}/../docker-compose/lofar-device-base/lofar-requirements.txt -r{toxinidir}/docs/docs-requirements.txt commands = - sphinx-build -W -b html docs/source docs/build/html + sphinx-build -W -b html docs/source docs/build/html [flake8] filename = *.py,.stestr.conf,.txt -- GitLab