From b8ef2c0254623d6c3527e4853dbe27baf8023b26 Mon Sep 17 00:00:00 2001 From: Jiri Podivin Date: Thu, 25 Feb 2021 13:35:29 +0100 Subject: [PATCH] Python 2.7 environment, mimicking the one used by RDO Prompted by a recent issue: https://review.rdoproject.org/r/#/c/32074/ New py27 environment approximates the steps taken during the rdo packaging. Signed-off-by: Jiri Podivin Change-Id: I9a74516f2b55f0ddf1f04637f0301c281903bb88 --- tox.ini | 23 +++++++++++++++++++++++ validations_common/library/__init__.py | 0 2 files changed, 23 insertions(+) create mode 100644 validations_common/library/__init__.py diff --git a/tox.ini b/tox.ini index f172dcf..9b10c31 100644 --- a/tox.ini +++ b/tox.ini @@ -39,6 +39,29 @@ deps = -r {toxinidir}/doc/requirements.txt whitelist_externals = bash +[testenv:py27] +envtmpdir={envdir}/tmp +skip_install = true +commands_pre = + cp -r {toxinidir}/validations_common {envtmpdir}/validations_common + touch {envtmpdir}/validations_common/library/__init__.py + find {envtmpdir}/validations_common/tests/ -type f -exec sed -i -e 's/from unittest import mock/import mock/g' \{\} ; + find {envtmpdir}/validations_common/tests/ -type f -exec sed -i -e 's/from unittest.mock/from mock/g' \{\} ; + find {envtmpdir} -type f -name 'setup.cfg' -exec sed -i -e 's/python-requires = >=3.6/python-requires = >=2.7/g' \{\} ; +commands = + python2.7 -m unittest discover -s {envtmpdir}/validations_common/tests +deps = + -c {env:TOX_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/train/upper-constraints.txt} + -r {toxinidir}/requirements.txt + -r {toxinidir}/test-requirements.txt + ansible>=2 +whitelist_externals = + bash + cp + find + sed + touch + [testenv:bindep] # Do not install any requirements. We want this to be fast and work even if # system dependencies are missing, since it's used to tell you what system diff --git a/validations_common/library/__init__.py b/validations_common/library/__init__.py new file mode 100644 index 0000000..e69de29