Add log_all_test_params.py
Run Pytest with HTML and XML Test Reports / tests (push) Failing after 20s
Run Pytest with HTML and XML Test Reports / tests (push) Failing after 20s
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import os
|
||||
import pprint
|
||||
from extract_parametrize import extract_all_parametrize
|
||||
|
||||
def find_test_files(root_dir):
|
||||
"""Retourne la liste des chemins vers les fichiers test_*.py dans root_dir"""
|
||||
test_files = []
|
||||
for dirpath, _, filenames in os.walk(root_dir):
|
||||
for fname in filenames:
|
||||
if fname.startswith("test_") and fname.endswith(".py"):
|
||||
test_files.append(os.path.join(dirpath, fname))
|
||||
return test_files
|
||||
|
||||
def extract_all_tests_params(root_dir):
|
||||
all_params = {}
|
||||
test_files = find_test_files(root_dir)
|
||||
|
||||
for filepath in test_files:
|
||||
try:
|
||||
param_data = extract_all_parametrize(filepath)
|
||||
if param_data:
|
||||
all_params[filepath] = param_data
|
||||
except Exception as e:
|
||||
print(f"❌ Erreur lors du parsing de {filepath} : {e}")
|
||||
|
||||
return all_params
|
||||
|
||||
if __name__ == "__main__":
|
||||
result = extract_all_tests_params("tests")
|
||||
pprint.pprint(result, sort_dicts=False)
|
||||
Reference in New Issue
Block a user