forked from sympy/sympy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_test_list.py
71 lines (60 loc) · 1.64 KB
/
generate_test_list.py
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
"""
Execute like this:
$ python bin/generate_test_list.py
tests = [
'sympy.concrete.tests',
'sympy.core.tests',
'sympy.functions.combinatorial.tests',
'sympy.functions.elementary.tests',
'sympy.functions.special.tests',
'sympy.geometry.tests',
'sympy.integrals.tests',
'sympy.matrices.tests',
'sympy.ntheory.tests',
'sympy.numerics.tests',
'sympy.parsing.tests',
'sympy.physics.tests',
'sympy.plotting.tests',
'sympy.polynomials.tests',
'sympy.printing.tests',
'sympy.series.tests',
'sympy.simplify.tests',
'sympy.solvers.tests',
'sympy.specfun.tests',
'sympy.test_external',
'sympy.utilities.tests',
]
"""
from __future__ import print_function
from glob import glob
def get_paths(level=15):
"""
Generates a set of paths for testfiles searching.
Examples
========
>>> get_paths(2)
['sympy/test_*.py', 'sympy/*/test_*.py', 'sympy/*/*/test_*.py']
>>> get_paths(6)
['sympy/test_*.py', 'sympy/*/test_*.py', 'sympy/*/*/test_*.py',
'sympy/*/*/*/test_*.py', 'sympy/*/*/*/*/test_*.py',
'sympy/*/*/*/*/*/test_*.py', 'sympy/*/*/*/*/*/*/test_*.py']
"""
wildcards = ["/"]
for i in range(level):
wildcards.append(wildcards[-1] + "*/")
p = ["sympy" + x + "test_*.py" for x in wildcards]
return p
def generate_test_list():
g = []
for x in get_paths():
g.extend(glob(x))
g = [".".join(x.split("/")[:-1]) for x in g]
g = list(set(g))
g.sort()
return g
if __name__ == '__main__':
g = generate_test_list()
print("tests = [")
for x in g:
print(" '%s'," % x)
print("]")