forked from plone/buildout.coredev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfind-test-isolation-problems.py
49 lines (42 loc) · 1.29 KB
/
find-test-isolation-problems.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
# -*- coding: utf-8 -*-
import argparse
import ConfigParser
import subprocess
def probe_egg(package, test_egg):
args = [
'bin/test',
'-s',
package,
'-s',
test_egg,
]
print('Probing {0}'.format(test_egg))
try:
subprocess.check_output(args)
except subprocess.CalledProcessError as e:
print('### FAILURE ###')
print('{} has test isolation issues.'.format(test_egg))
print('--')
print(e.output)
print('--')
print('### FAILURE ###')
print('')
def find_test_isolation_problems(package):
"""Read packages in the plone_app_testing alltests group from tests.cfg
and probe them for test isolation issues.
"""
tests_config = ConfigParser.ConfigParser()
tests_config.readfp(open('tests.cfg'))
test_eggs = tests_config.get("test-groups", "plone_app_testing")
test_eggs = [
x.split(' ')[0]
for x in test_eggs.split('\n')
if len(x) > 0 and '$' not in x and x != package
]
for test_egg in test_eggs:
probe_egg(package, test_egg)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('package')
args = parser.parse_args()
find_test_isolation_problems(args.package)