-
Notifications
You must be signed in to change notification settings - Fork 1
/
runAll.py
63 lines (56 loc) · 1.81 KB
/
runAll.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
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# -----------------------------------------------------------------------------
#
# P A G E B O T N A N O
#
# Copyright (c) 2020+ Buro Petr van Blokland + Claudia Mens
# www.pagebot.io
# Licensed under MIT conditions
#
# Supporting DrawBot, www.drawbot.com
# -----------------------------------------------------------------------------
#
# testAll.py
#
# Run all versions to check for doc-test errors.
#
import os
import sys
import importlib
from random import random
import drawBot
VERBOSE = False # If True, show all file names as they are tested.
def testPath(path, level=0):
os.chdir(path)
for fileName in sorted(os.listdir('.')):
if fileName.startswith('.') or fileName.startswith('_'):
continue
if os.path.isdir(fileName):
testPath(fileName, level+1)
elif fileName.endswith('.py'):
if VERBOSE:
print('... %s %s/%s' % ('\t'*level, path, fileName))
# Not using exec(open(fileName).read())
# to get a "clean" python sys path.
os.system('python3 ' + fileName)
os.chdir('..')
# Versions that pass the doc tests
MAIN_VERSION = [0]
RUNNING_VERSIONS = [1, 2, 3, 4, 5, 6, 7, 8, 9, 20]
# Version under development
DEVELOPMENT_VERSIONS = [10, 30, 40, 50]
# Versions to test
TEST_VERSIONS = RUNNING_VERSIONS
#TEST_VERSIONS = RUNNING_VERSIONS + DEVELOPMENT_VERSIONS
#TEST_VERSIONS = [30]
for fileName in sorted(os.listdir('.')):
if not os.path.isdir(fileName) or fileName.startswith('.'):
continue
if fileName == 'PageBotNano':
version = 0
elif fileName.startswith('PageBotNano'):
version = int(fileName.split('-')[1])
if version in TEST_VERSIONS:
testPath(fileName)
print('Done running %s test(s)' % len(TEST_VERSIONS))