Bump version to 24.04.3.4
[LibreOffice.git] / bin / list-uitest.py
blob5678fb346c49ff74cfb295eb7c6b5221cfa1cc6a
1 #!/usr/bin/env python3
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 import os
10 import datetime
11 import re
13 def analyze_file(filename):
14 class_name = ""
15 method_list = []
16 with open(filename, encoding='utf-8') as fh:
17 for line in fh:
18 if line.lstrip().startswith('class '):
19 class_name = line.lstrip().split(" ")[1].split("(")[0]
20 elif line.lstrip().startswith('def test_'):
21 method_list.append(
22 line.lstrip().split("test_")[1].split("(")[0])
23 else:
24 continue
25 return class_name, method_list
27 def get_files_list(directory, extension):
28 array_items = []
30 dh = os.scandir(directory)
31 for entry in dh:
32 if entry.is_dir():
33 array_items += get_files_list(entry.path, extension)
34 elif entry.is_file():
35 if entry.name.endswith(extension):
36 array_items.append(entry.path)
38 return array_items
40 def linkFormat(name):
41 bugId = re.search(r'\d{5,6}', name)
42 if bugId:
43 return "[https://bugs.documentfoundation.org/show_bug.cgi?id={} {}]"\
44 .format(bugId.group(), name)
45 else:
46 return name
49 def main():
50 uitest_ext = '.py'
51 uitest_dirs = {
52 'Writer' : ['../writerperfect/qa/uitest/', '../sw/qa/uitest/'],
53 'Calc' : ['../sc/qa/uitest/'],
54 'Impress' : ['../uitest/impress_tests/', '../sd/qa/uitest/'],
55 'Math': ['../uitest/math_tests/'],
56 'Demo': ['../uitest/demo_ui/'],
57 'Draw': ['']}
59 print('{{TopMenu}}')
60 print('{{Menu}}')
61 print('{{Menu.Development}}')
62 print()
63 print('Generated on ' + str(datetime.datetime.now()))
64 for k,v in uitest_dirs.items():
65 print('\n=== ' + k + ' ===')
66 for uitest_dir in v:
67 if uitest_dir:
68 uitest_files = get_files_list(uitest_dir, uitest_ext)
69 for uitest_file in uitest_files:
70 class_name, method_names = analyze_file(uitest_file)
71 if class_name:
72 print("# {} ({})".format(
73 linkFormat(class_name),uitest_file[3:]))
74 for m in method_names:
75 print('##' + linkFormat(m))
76 print()
77 print('[[Category:QA]][[Category:Development]]')
79 if __name__ == '__main__':
80 main()