forked from cirosantilli/python-cheat
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
executable file
·64 lines (59 loc) · 1.25 KB
/
test.py
File metadata and controls
executable file
·64 lines (59 loc) · 1.25 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
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python
"""
Run all scripts.
They should exit 0.
"""
import subprocess
import sys
import os
import os.path
# Either:
#
# - requires user input
# - takes too long
# - dependencies that are complicated to install
# - uses network resources
# - simply broken
#
blacklist = [
# Broken.
'main',
# Large download.
'nltk_cheat',
# pip build takes too long.
'numpy_cheat',
'scipy_cheat',
# Networking.
'smtplib_cheat',
# infinite loop!
'test',
# Meant to fail.
'unittest_cheat',
# Networking.
'urllib2_cheat',
# Interactive.
'wsgi',
]
ext = '.py'
# TODO: remove this and run all .py files
scripts = []
for f in os.listdir(u'.'):
if os.path.isfile(f) and os.access(f, os.X_OK):
noext, ext = os.path.splitext(f)
if ext == '.py' and not noext in blacklist:
scripts.append(f)
scripts.sort()
for script in scripts:
print script
process = subprocess.Popen(
['./' + script],
shell = False,
stdin = subprocess.PIPE,
stdout = subprocess.PIPE,
stderr = subprocess.PIPE,
universal_newlines = True
)
if process.wait() != 0:
print('ASSERT FAILED: ' + script)
sys.exit(1)
print 'ALL ASSERTS PASSED'