Update framework before switching to pytest

Change-Id: Ife5941283fb1266c5873798f328f47e5f91f6ae8
This commit is contained in:
Federico Ressi 2020-12-03 14:33:53 +01:00
parent f77a662522
commit ab9715a7aa
5 changed files with 9 additions and 3 deletions

View File

@ -20,7 +20,6 @@ import traceback
import typing # noqa import typing # noqa
from oslo_log import log from oslo_log import log
from stestr import config_file
import testtools import testtools
from tobiko.common import _config from tobiko.common import _config
@ -85,6 +84,8 @@ class TestCasesFinder(object):
filter the output just like with the run command to see exactly what filter the output just like with the run command to see exactly what
will be run. will be run.
""" """
from stestr import config_file
params = dict(config=self.config, repo_type=self.repo_type, params = dict(config=self.config, repo_type=self.repo_type,
repo_url=self.repo_url, test_path=self.test_path, repo_url=self.repo_url, test_path=self.test_path,
top_dir=self.top_dir, group_regex=self.group_regex, top_dir=self.top_dir, group_regex=self.group_regex,

View File

@ -14,6 +14,7 @@
from __future__ import absolute_import from __future__ import absolute_import
import os import os
import subprocess
import testtools import testtools
@ -30,11 +31,15 @@ class DiscoverTestCasesTest(unit.TobikoUnitTest):
top_dir = os.path.abspath(self.test_path) top_dir = os.path.abspath(self.test_path)
while os.path.isdir(top_dir) and top_dir != os.path.sep: while os.path.isdir(top_dir) and top_dir != os.path.sep:
if os.path.isdir(os.path.join(top_dir, '.stestr')): if os.path.isfile(os.path.join(top_dir, 'tox.ini')):
break break
top_dir = os.path.dirname(top_dir) top_dir = os.path.dirname(top_dir)
else: else:
raise self.fail("Unable to find '.stestr' directory") self.fail("'tox.ini' file not found in any parent "
f"of directory '{self.test_path}'")
if not os.path.isdir(os.path.join(top_dir, '.stestr')):
subprocess.run(['stestr', 'init'], cwd=top_dir, check=True)
self.top_dir = top_dir self.top_dir = top_dir
self.repo_url = top_dir self.repo_url = top_dir