summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/packagetesting/testwheel.py28
1 files changed, 18 insertions, 10 deletions
diff --git a/scripts/packagetesting/testwheel.py b/scripts/packagetesting/testwheel.py
index 9aad708..ba9ca1d 100644
--- a/scripts/packagetesting/testwheel.py
+++ b/scripts/packagetesting/testwheel.py
@@ -4,6 +4,7 @@
from argparse import ArgumentParser, RawTextHelpFormatter
+from functools import cache
from pathlib import Path
import os
import shutil
@@ -61,6 +62,23 @@ def list_modules():
print(f"\nInstalled_modules ({len(installed_modules)}): {module_string}\n")
+@cache
+def get_installed_modules():
+ """Return installed modules"""
+ result = []
+ _, lines = run_process([sys.executable, "-m", "pip", "list"])
+ for l in lines:
+ tokens = l.split(' ')
+ if len(tokens) >= 1:
+ result.append(tokens[0].lower())
+ return result
+
+
+def has_module(name):
+ """Checks for a module"""
+ return name.lower() in get_installed_modules()
+
+
def pyside2_examples():
"""List of examples to be tested (PYSIDE 2)"""
return ['widgets/mainwindows/mdi/mdi.py',
@@ -138,16 +156,6 @@ def run_example(root, path):
print(f'{path} returned {exit_code}\n\n')
-def has_module(name):
- """Checks for a module"""
- code, lines = run_process([sys.executable, "-m", "pip", "list"])
- for l in lines:
- tokens = l.split(' ')
- if len(tokens) >= 1 and tokens[0].lower() == name.lower():
- return True
- return False
-
-
def test_deploy(example):
"""Test pyside6-deploy."""
base_name = example.name