From 8a6a3183ae2d1c98c45de208a46f7f4a47357ed0 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Sat, 29 Aug 2009 14:50:44 -0500 Subject: [PATCH] guard against tests trying to import this --HG-- branch : trunk --- py/_testing/check_compile.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/py/_testing/check_compile.py b/py/_testing/check_compile.py index c982babbf..df191d6b4 100644 --- a/py/_testing/check_compile.py +++ b/py/_testing/check_compile.py @@ -1,10 +1,13 @@ import sys -fn = sys.argv[1] -print("Testing %s" % (fn,)) -fp = open(fn, "rb") -try: - source = fp.read() -finally: - fp.close() -compile(source, fn, "exec") +def main(fn): + print("Testing %s" % (fn,)) + fp = open(fn, "rb") + try: + source = fp.read() + finally: + fp.close() + compile(source, fn, "exec") + +if __name__ == "__main__": + main(sys.argv[1])