1.1 --- a/test.py Sat Jul 14 01:37:42 2012 +0200
1.2 +++ b/test.py Sat Jul 14 17:42:42 2012 +0200
1.3 @@ -22,6 +22,15 @@
1.4 print "%6d" % (len(table_slice) - table_slice.count(None)), \
1.5 "".join(entry and "#" or "_" for entry in table_slice)
1.6
1.7 +def show_warnings(attribute_usage_failures):
1.8 + failures = list(attribute_usage_failures)
1.9 + failures.sort()
1.10 + for unit_name, name, attrnames, all_attributes in failures:
1.11 + attrnames = list(attrnames)
1.12 + attrnames.sort()
1.13 + print >>sys.stderr, "%s: Name %r with %s attributes %r" % (
1.14 + unit_name, name, all_attributes and "all" or "any", ", ".join(attrnames))
1.15 +
1.16 def attrs(obj):
1.17 for name, attr in obj.items():
1.18 print name, attr
1.19 @@ -61,6 +70,17 @@
1.20 m = i.load_from_file(filename)
1.21
1.22 p.finalise()
1.23 +
1.24 + # Show warnings.
1.25 +
1.26 + if "-w" in sys.argv:
1.27 + print >>sys.stderr
1.28 + print >>sys.stderr, "Warnings:"
1.29 + show_warnings(i.attribute_usage_failures)
1.30 + print >>sys.stderr
1.31 +
1.32 + # Make the builtins module available through a variable.
1.33 +
1.34 b = i.get_module("__builtins__")
1.35
1.36 # Make a report.