Message ID | 20220610222605.2259132-8-jsnow@redhat.com |
---|---|
State | New |
Headers | show |
Series | tests: run python tests under a venv | expand |
diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py index 29404ac94be..e985eaf3e97 100644 --- a/tests/qemu-iotests/testenv.py +++ b/tests/qemu-iotests/testenv.py @@ -112,10 +112,10 @@ def init_directories(self) -> None: """ venv_path = Path(self.build_root, 'tests/venv/') if not venv_path.exists(): - raise FileNotFoundError( - f"Virtual environment \"{venv_path!s}\" isn't found." - " (Maybe you need to run 'make check-venv'" - " from the build dir?)" + mkvenv = Path(self.source_iotests, '../mkvenv.py') + subprocess.run( + (sys.executable, str(mkvenv), str(venv_path)), + check=True, ) self.virtual_env: str = str(venv_path)
When iotests are invoked manually from e.g. $build/tests/qemu-iotests/check, it is not necessarily guaranteed that we'll have run 'check-venv' yet. With this patch, teach testenv.py how to create its own environment. Note: this self-bootstrapping is fairly rudimentary and will miss certain triggers to refresh the venv. It will miss when new dependencies are added to either python/setup.cfg or tests/setup.cfg. It can be coaxed into updating by running 'make check', 'make check-block', 'make check-venv', etc. Signed-off-by: John Snow <jsnow@redhat.com> --- tests/qemu-iotests/testenv.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)