Split out tox job for neko tests from unittests and fix issues

This commit splits out the tox job configuration for the neko
integration tests from the unittests. Previously the default tox
job was running unittests and the integration tests. This was less than
ideal because sometimes you want to just run unittests and not the neko
test suite. In doing this split some issues in the recent changes made
to the neko framework were identified and fixed as part of this.
This commit is contained in:
Matthew Treinish 2022-01-07 13:23:17 -05:00
parent 4ad75b4533
commit 4c08e95a46
No known key found for this signature in database
GPG Key ID: FD12A0F214C9E177
3 changed files with 11 additions and 5 deletions

View File

@ -48,6 +48,9 @@ class BackendPluginManager:
LOG.error("Could not load %r: %s", ep.name, err)
raise err
def get_plugin_backends(self):
def get_plugin_backends(self, backend_selection=None):
"""Return a dictionary of plugin names to backend objects."""
return {plug.name: plug.obj.get_backend() for plug in self.ext_plugins}
return {
plug.name: plug.obj.get_backend(backend_selection=backend_selection)
for plug in self.ext_plugins
}

View File

@ -316,12 +316,12 @@ class BaseTestCase(testtools.testcase.WithAttributes, testtools.TestCase):
if self.config:
backend_script_path = self.config.config.get("backend_script", None)
backend_selection = self.config.config.get("backend_selection", None)
if "backend_script" is not None:
if backend_script_path is not None:
plugin = self.load_plugin_script(backend_script_path)
self.backend = plugin.get_backend(backend_selection)
else:
plugin = self.config.config.get("backend_plugin", "aer")
self.backends = self.plugin_manager().get_plugin_backends(backend_selection)
self.backends = self.plugin_manager.get_plugin_backends(backend_selection)
self.backend = self.backends[plugin]
else:
self.backends = backend_plugin.BackendPluginManager().get_plugin_backends()

View File

@ -1,6 +1,6 @@
[tox]
minversion = 2.1
envlist = py310,py39,py38,py37,py36,lint
envlist = py310,py39,py38,py37,py36,neko,lint
skipsdist = True
[testenv]
@ -13,6 +13,9 @@ deps =
-r{toxinidir}/requirements-dev.txt
commands =
stestr --test-path ./tests run {posargs}
[testenv:neko]
commands =
stestr run {posargs}
[testenv:lint]