]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
Rewrite module import tests
authorZack Cerza <zack@redhat.com>
Thu, 25 Jul 2024 20:29:15 +0000 (14:29 -0600)
committerZack Cerza <zack@redhat.com>
Fri, 2 Aug 2024 18:47:31 +0000 (12:47 -0600)
These are 38x faster. They also helped me find and fix a bug in the exporter

Signed-off-by: Zack Cerza <zack@redhat.com>
teuthology/test/test_imports.py

index b73ade15ec9e7351dfa844a1316e41bd01a59eef..cb25c8d0afd031069d1002ba1a4ab9eac2d9ebcf 100644 (file)
@@ -1,7 +1,8 @@
+import importlib
 import pytest
+import sys
 
 from pathlib import Path
-from subprocess import check_call
 from typing import List
 
 root = Path("./teuthology")
@@ -26,4 +27,5 @@ def find_modules() -> List[str]:
 
 @pytest.mark.parametrize("module", find_modules())
 def test_import_modules(module):
-    check_call(["python3", "-c", f"import {module}"])
+    importlib.import_module(module)
+    assert module in sys.modules