##// END OF EJS Templates
check-py3-compat: manually format and print warnings...
Gregory Szorc -
r41696:ba7eaff2 default
parent child Browse files
Show More
@@ -14,6 +14,7 b' import importlib'
14 import os
14 import os
15 import sys
15 import sys
16 import traceback
16 import traceback
17 import warnings
17
18
18 def check_compat_py2(f):
19 def check_compat_py2(f):
19 """Check Python 3 compatibility for a file with Python 2"""
20 """Check Python 3 compatibility for a file with Python 2"""
@@ -91,6 +92,11 b" if __name__ == '__main__':"
91 fn = check_compat_py3
92 fn = check_compat_py3
92
93
93 for f in sys.argv[1:]:
94 for f in sys.argv[1:]:
94 fn(f)
95 with warnings.catch_warnings(record=True) as warns:
96 fn(f)
97
98 for w in warns:
99 print(warnings.formatwarning(w.message, w.category,
100 w.filename, w.lineno).rstrip())
95
101
96 sys.exit(0)
102 sys.exit(0)
General Comments 0
You need to be logged in to leave comments. Login now