1
- import sys
2
- import glob
3
- import re
1
+ from pathlib import Path
2
+ from typing import List
4
3
5
4
from bs4 import BeautifulSoup
6
5
6
+ REPO_ROOT = Path (__file__ ).parent .parent
7
+
7
8
# files that are ok to have 0 min 0 sec time, probably because they don't have any python code
8
9
OK_TO_NOT_RUN = [
9
10
"beginner/basics/intro.html" ,
69
70
]
70
71
71
72
72
- def main ():
73
- build_dir = sys .argv [1 ]
73
+ def tutorial_source_dirs () -> List [Path ]:
74
+ return [
75
+ p .relative_to (REPO_ROOT ).with_stem (p .stem [:- 7 ])
76
+ for p in REPO_ROOT .glob ("*_source" )
77
+ ]
74
78
75
- html_file_paths = []
76
79
77
- for difficulty in ["beginner" , "intermediate" , "advanced" , "prototype" , "recipes" ]:
78
- glob_path = f"{ build_dir } /{ difficulty } /**/*.html"
79
- html_file_paths += glob .glob (glob_path , recursive = True )
80
+ def main () -> None :
81
+ docs_dir = REPO_ROOT / "docs"
82
+ html_file_paths = []
83
+ for tutorial_source_dir in tutorial_source_dirs ():
84
+ glob_path = f"{ tutorial_source_dir } /**/*.html"
85
+ html_file_paths += docs_dir .glob (glob_path )
80
86
81
87
did_not_run = []
82
88
for html_file_path in html_file_paths :
@@ -89,10 +95,10 @@ def main():
89
95
"Total running time of the script: ( 0 minutes 0.000 seconds)"
90
96
in elem .text
91
97
and not any (
92
- html_file_path .endswith (file ) for file in KNOWN_BAD + OK_TO_NOT_RUN
98
+ html_file_path .match (file ) for file in KNOWN_BAD + OK_TO_NOT_RUN
93
99
)
94
100
):
95
- did_not_run .append (html_file_path )
101
+ did_not_run .append (html_file_path . as_posix () )
96
102
97
103
if len (did_not_run ) != 0 :
98
104
raise RuntimeError (
0 commit comments