diff options
author | Brett Cannon <bcannon@gmail.com> | 2008-04-01 12:46:02 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2008-04-01 12:46:02 (GMT) |
commit | 8820f2a979806d4e8966a809052870f8f895b2f4 (patch) | |
tree | 39c33b70b9ee9028c68072b13af37881f1212215 /Lib | |
parent | 8d2a90af2dd04877e5df4c12fd71e1ae86a3b7b9 (diff) | |
download | cpython-8820f2a979806d4e8966a809052870f8f895b2f4.zip cpython-8820f2a979806d4e8966a809052870f8f895b2f4.tar.gz cpython-8820f2a979806d4e8966a809052870f8f895b2f4.tar.bz2 |
Add ``if __name__ == '__main__'`` to some test files where it didn't take a lot
of effort to do so.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_code.py | 4 | ||||
-rwxr-xr-x | Lib/test/test_dl.py | 41 | ||||
-rw-r--r-- | Lib/test/test_frozen.py | 5 | ||||
-rw-r--r-- | Lib/test/test_lib2to3.py | 4 |
4 files changed, 36 insertions, 18 deletions
diff --git a/Lib/test/test_code.py b/Lib/test/test_code.py index 4e68638..b69223d 100644 --- a/Lib/test/test_code.py +++ b/Lib/test/test_code.py @@ -100,3 +100,7 @@ def test_main(verbose=None): from test.test_support import run_doctest from test import test_code run_doctest(test_code, verbose) + + +if __name__ == '__main__': + test_main() diff --git a/Lib/test/test_dl.py b/Lib/test/test_dl.py index b70a4cf..a2e4460 100755 --- a/Lib/test/test_dl.py +++ b/Lib/test/test_dl.py @@ -13,22 +13,27 @@ sharedlibs = [ ('/usr/lib/libc.dylib', 'getpid'), ] -for s, func in sharedlibs: - try: - if verbose: - print 'trying to open:', s, - l = dl.open(s) - except dl.error, err: - if verbose: - print 'failed', repr(str(err)) - pass +def test_main(): + for s, func in sharedlibs: + try: + if verbose: + print 'trying to open:', s, + l = dl.open(s) + except dl.error, err: + if verbose: + print 'failed', repr(str(err)) + pass + else: + if verbose: + print 'succeeded...', + l.call(func) + l.close() + if verbose: + print 'worked!' + break else: - if verbose: - print 'succeeded...', - l.call(func) - l.close() - if verbose: - print 'worked!' - break -else: - raise TestSkipped, 'Could not open any shared libraries' + raise TestSkipped, 'Could not open any shared libraries' + + +if __name__ == '__main__': + test_main() diff --git a/Lib/test/test_frozen.py b/Lib/test/test_frozen.py index 621720c..e981fb3 100644 --- a/Lib/test/test_frozen.py +++ b/Lib/test/test_frozen.py @@ -38,3 +38,8 @@ class FrozenTests(unittest.TestCase): def test_main(): run_unittest(FrozenTests) + + + +if __name__ == '__main__': + test_main() diff --git a/Lib/test/test_lib2to3.py b/Lib/test/test_lib2to3.py index beda695..161b9dd 100644 --- a/Lib/test/test_lib2to3.py +++ b/Lib/test/test_lib2to3.py @@ -13,3 +13,7 @@ def suite(): def test_main(): run_unittest(suite()) + + +if __name__ == '__main__': + test_main() |