summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2023-03-20 13:37:02 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2023-03-22 10:15:32 +0100
commit94b95f153cc0b6ef1ff15876a4821f15ad4a8dd6 (patch)
tree2c288465f8c329f0119a4196b4a87427ff6c5622
parent70fa0d9c104051c3971aad2fafdbe3b660260046 (diff)
downloadqtqa-94b95f153cc0b6ef1ff15876a4821f15ad4a8dd6.tar.gz
testwheel.py: Cache the result of pip list
Pick-to: master Task-number: PYSIDE-2247 Change-Id: I6460973524f36c4dbfae99fd75a177e43a99a310 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
-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