From c8e66a89f2e23ea26c98468a4b4fcc356a5bdc1a Mon Sep 17 00:00:00 2001 From: Jiri Podivin Date: Fri, 5 Mar 2021 15:58:26 +0100 Subject: [PATCH] Python tests are now run trough stestr. Number of the environment variables passed to tox envs was reduced from all, to just one. This is preparatory step for further test developmet. Reviews for test infrastructure, refactoring and coverage will be on branches from this one. tools/validate_files.py: Changed encoding to utf-8 to prevent linting error. Signed-off-by: Jiri Podivin Change-Id: Idd82aecb7b66433396639ed800a33b109a06e11a --- .stestr.conf | 3 +++ test-requirements.txt | 1 + tools/validate-files.py | 2 +- tox.ini | 11 ++++++++--- 4 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 .stestr.conf diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 000000000..5ed95bafd --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=${TEST_PATH:-./tripleo_validations/tests} +top_dir=./ diff --git a/test-requirements.txt b/test-requirements.txt index 81ee12b90..5785d774f 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -14,3 +14,4 @@ testtools>=2.2.0 # MIT reno>=3.1.0 # Apache-2.0 netaddr>=0.7.18 # BSD pre-commit # MIT +stestr>=3.0.1 # Apache-2.0 diff --git a/tools/validate-files.py b/tools/validate-files.py index 7b35e06a6..afdce674f 100755 --- a/tools/validate-files.py +++ b/tools/validate-files.py @@ -22,7 +22,7 @@ def exit_usage(): def validate_library_file(file_path): - with open(file_path) as f: + with open(file_path, encoding='utf-8') as f: file_content = f.read() if 'DOCUMENTATION = ' not in file_content \ or 'EXAMPLES = ' not in file_content: diff --git a/tox.ini b/tox.ini index 73ec4bb2b..abc5f5aec 100644 --- a/tox.ini +++ b/tox.ini @@ -7,7 +7,7 @@ ignore_basepython_conflict = True [testenv] basepython = python3 usedevelop = True -passenv = * +passenv = TERM setenv = ANSIBLE_CALLBACK_PLUGINS={toxinidir}/callback_plugins ANSIBLE_LOOKUP_PLUGINS={toxinidir}/lookup_plugins @@ -21,8 +21,13 @@ setenv = # paramiko CryptographyDeprecationWarning: https://github.com/ansible/ansible/issues/52598 PYTHONWARNINGS=ignore:DEPRECATION::pip._internal.cli.base_command,ignore::UserWarning PIP_DISABLE_PIP_VERSION_CHECK=1 -commands = python setup.py test --slowest --testr-args='{posargs}' -sitepackages = True + PIP_+ VIRTUAL_ENV={envdir} + LANG=en_US.UTF-8 + LANGUAGE=en_US:en + LC_ALL=C + HOME={envdir} +commands = + stestr run --slowest --color {posargs} deps = -c {env:TOX_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} -r {toxinidir}/requirements.txt