mirror of https://github.com/python/cpython
Add ``if __name__ == '__main__'`` to some test files where it didn't take a lot
of effort to do so.
This commit is contained in:
parent
8d2a90af2d
commit
8820f2a979
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -38,3 +38,8 @@ class FrozenTests(unittest.TestCase):
|
|||
|
||||
def test_main():
|
||||
run_unittest(FrozenTests)
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
test_main()
|
||||
|
|
|
@ -13,3 +13,7 @@ def suite():
|
|||
|
||||
def test_main():
|
||||
run_unittest(suite())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
test_main()
|
||||
|
|
Loading…
Reference in New Issue