From b7df3a48e4bbc53500c64e8943159e2c7b30ba1e Mon Sep 17 00:00:00 2001 From: HeroicHitesh Date: Wed, 30 Jun 2021 20:17:56 +0530 Subject: [PATCH] Remove testr * Remove tests and tools directories since openstack-specs-jobs runs only docs * Remove .testr.conf as there are will be no tests directory present in this repository after this change and update .gitignore accordingly * Use 3.18.0 as the minversion for tox in order to use allowlist_externals option Signed-off-by: HeroicHitesh Change-Id: I345f16d0956b8e397b282902a211159e11f902c8 --- .testr.conf | 4 -- tests/__init__.py | 0 tests/test_titles.py | 110 ------------------------------------------- tools/with_venv.sh | 8 ---- tox.ini | 4 +- 5 files changed, 2 insertions(+), 124 deletions(-) delete mode 100644 .testr.conf delete mode 100644 tests/__init__.py delete mode 100644 tests/test_titles.py delete mode 100644 tools/with_venv.sh diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index 1641f86..0000000 --- a/.testr.conf +++ /dev/null @@ -1,4 +0,0 @@ -[DEFAULT] -test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_TEST_TIMEOUT=60 ${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION -test_id_option=--load-list $IDFILE -test_list_option=--list diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/tests/test_titles.py b/tests/test_titles.py deleted file mode 100644 index ff245f9..0000000 --- a/tests/test_titles.py +++ /dev/null @@ -1,110 +0,0 @@ -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import glob -import re - -import docutils.core -import testtools - - -class TestTitles(testtools.TestCase): - def _get_title(self, section_tree): - section = { - 'subtitles': [], - } - for node in section_tree: - if node.tagname == 'title': - section['name'] = node.rawsource.lower() - elif node.tagname == 'section': - subsection = self._get_title(node) - subsection['name'] = subsection['name'].lower() - section['subtitles'].append(subsection['name']) - return section - - def _get_titles(self, spec): - titles = {} - for node in spec: - if node.tagname == 'section': - section = self._get_title(node) - titles[section['name']] = section['subtitles'] - return titles - - def _check_titles(self, fname, titles): - expected_titles = [ - 'problem description', - 'proposed change', - 'implementation', - 'testing', - 'documentation impact', - 'references' - ] - self.assertEqual( - sorted(expected_titles), - sorted(titles.keys()), - "Expected titles not found in document %s" % fname - ) - - try: - proposed = 'proposed change' - self.assertIn('alternatives', titles[proposed]) - self.assertIn('dependencies', titles[proposed]) - self.assertIn('deployer impact', titles[proposed]) - self.assertIn('developer impact', titles[proposed]) - self.assertIn('end user impact', titles[proposed]) - self.assertIn('performance impact', titles[proposed]) - try: - self.assertIn('playbook impact', titles[proposed]) - except AssertionError: - self.assertIn('playbook/role impact', titles[proposed]) - self.assertIn('security impact', titles[proposed]) - self.assertIn('upgrade impact', titles[proposed]) - - impl = 'implementation' - self.assertIn('assignee(s)', titles[impl]) - self.assertIn('work items', titles[impl]) - except Exception as exp: - raise SystemExit('Failed on file %s - Error %s' % (fname, exp)) - def _check_lines_wrapping(self, tpl, raw): - for i, line in enumerate(raw.split("\n")): - if "http://" in line or "https://" in line: - continue - self.assertTrue( - len(line) <= 120, - msg="%s:%d: Line limited to a maximum of 120 characters." % - (tpl, i+1) - ) - - def _check_no_cr(self, tpl, raw): - matches = re.findall('\r', raw) - self.assertEqual( - len(matches), 0, - "Found %s literal carriage returns in file %s" % - (len(matches), tpl) - ) - - def test_template(self): - files = ['specs/template.rst'] + glob.glob('specs/*/*') - # filtering images subdirectory - files = filter(lambda x: 'images' not in x, files) - for filename in files: - self.assertTrue( - filename.endswith(".rst"), - "spec's file must uses 'rst' extension." - ) - with open(filename) as f: - data = f.read() - - spec = docutils.core.publish_doctree(data) - self._check_titles(filename, self._get_titles(spec)) - self._check_lines_wrapping(filename, data) - self._check_no_cr(filename, data) diff --git a/tools/with_venv.sh b/tools/with_venv.sh deleted file mode 100644 index 15cc165..0000000 --- a/tools/with_venv.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -tools_path=${tools_path:-$(dirname $0)} -venv_path=${venv_path:-${tools_path}} -venv_dir=${venv_name:-/../.venv} -TOOLS=${tools_path} -VENV=${venv:-${venv_path}/${venv_dir}} -source ${VENV}/bin/activate && "$@" - diff --git a/tox.ini b/tox.ini index 88227d7..9111a66 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -minversion = 3.1 +minversion = 3.18.0 skipsdist = True envlist = docs ignore_basepython_conflict = True @@ -21,7 +21,7 @@ passenv = HTTPS_PROXY no_proxy NO_PROXY -whitelist_externals = +allowlist_externals = bash setenv = PYTHONUNBUFFERED=1