-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathExample.py
More file actions
52 lines (47 loc) · 1.09 KB
/
Example.py
File metadata and controls
52 lines (47 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import os
import sys
import traceback
import importlib
# add src to path
sys.path.insert(1, os.path.join(os.path.dirname(os.path.abspath(__file__)), "src"))
modules = [
"AddComment",
"AddTags",
"AddTagAsArtifact",
"AddWatermark",
"ConvertToHtml",
"ConvertToHtmlByPages",
"DocumentMetadata",
"EditContent",
"EditPageObjectMCID",
"EditTagProperties",
"EditTagReadingOrder",
"ExtractImages",
"ExtractTables",
"ExtractText",
"MakeAccessible",
"OpenDocFromStream",
"RenderPage",
"PdfToJson",
"SetFormFieldValue",
"TagLink",
]
failed = []
for module_name in modules:
print(f"\n=== Running: {module_name} ===")
try:
importlib.import_module(module_name)
print(f"OK: {module_name}")
except Exception as e:
print(f"FAILED: {module_name}")
print(f"Error: {e}")
traceback.print_exc()
failed.append(module_name)
print("\n=========================")
if failed:
print("FAILED MODULES:")
for m in failed:
print(f" - {m}")
sys.exit(1)
else:
print("ALL MODULES PASSED")