File: jython_checker.py

package info (click to toggle)
jython 2.5.2-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 72,424 kB
  • sloc: python: 375,154; java: 216,094; xml: 1,413; sh: 330; ansic: 126; perl: 122; makefile: 98
file content (45 lines) | stat: -rw-r--r-- 1,210 bytes parent folder | download | duplicates (9)
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
import sys
def usage():
    print 'Usage: jython jython_checker.py <module name created by make_checker>'
    sys.exit(1)

if not len(sys.argv) == 2:
    usage()
checker_name = sys.argv[1].split('.')[0]#pop off the .py if needed
try:
    checker = __import__(checker_name)
except:
    print 'No module "%s" found' % checker_name
    usage()
    
import make_checker

ignored_types = ['frame',
		 'code',
		 'traceback']
checks = []
for check in checker.checks:
    index, expected_type, expected_bases, expected_dict = check
    if checker.names[index] in ignored_types:
	print 'Skipping', checker.names[index]
	continue
    checks.append(check)
    
    
ignored_members = ['__getattribute__', '__doc__']

ok, missing, bad_type, different = make_checker.do_check(checker.names, checks)

def strip_ignored(differences, key, ignored):
    if not key in differences:
	return
    problems = differences[key]
    for member in ignored_members:
	if member in problems:
	    problems.remove(member)
	    
for t, name, differences in different:
    strip_ignored(differences, 'missing', ignored_members)
    strip_ignored(differences, 'extras', ignored_members)

make_checker.report(ok, missing, bad_type, different)