from teuthology import misc as teuthology
from teuthology import contextutil
+from teuthology import packaging
from teuthology.exceptions import ConfigError
from teuthology.orchestra import run
def get_toxvenv_dir(ctx):
return ctx.tox.venv_path
+@contextlib.contextmanager
+def install_python3(ctx, config):
+ assert isinstance(config, dict)
+ log.info('Installing Python3 for Tempest')
+ installed = []
+ for (client, _) in config.items():
+ (remote,) = ctx.cluster.only(client).remotes.keys()
+ try:
+ packaging.get_package_version(remote, 'python3')
+ except:
+ packaging.install_package('python3', remote)
+ installed.append(client)
+ try:
+ yield
+ finally:
+ log.info('Removing Python3 required by Tempest...')
+ for client in installed:
+ (remote,) = ctx.cluster.only(client).remotes.keys()
+ packaging.remove_package('python3', remote)
+
@contextlib.contextmanager
def setup_venv(ctx, config):
"""
with contextutil.nested(
lambda: download(ctx=ctx, config=config),
+ lambda: install_python3(ctx=ctx, config=config),
lambda: setup_venv(ctx=ctx, config=config),
lambda: configure_instance(ctx=ctx, config=config),
lambda: run_tempest(ctx=ctx, config=config),