Issue #6615: logging: Used weak references in internal handler list. Thanks to flox...
[python.git] / Lib / test / test_dl.py
bloba3f04ea781e050d825be54305a150a71701cc8cb
1 #! /usr/bin/env python
2 """Test dlmodule.c
3 Roger E. Masse revised strategy by Barry Warsaw
4 """
5 from test.test_support import verbose, import_module
6 dl = import_module('dl', deprecated=True)
8 sharedlibs = [
9 ('/usr/lib/libc.so', 'getpid'),
10 ('/lib/libc.so.6', 'getpid'),
11 ('/usr/bin/cygwin1.dll', 'getpid'),
12 ('/usr/lib/libc.dylib', 'getpid'),
15 def test_main():
16 for s, func in sharedlibs:
17 try:
18 if verbose:
19 print 'trying to open:', s,
20 l = dl.open(s)
21 except dl.error, err:
22 if verbose:
23 print 'failed', repr(str(err))
24 pass
25 else:
26 if verbose:
27 print 'succeeded...',
28 l.call(func)
29 l.close()
30 if verbose:
31 print 'worked!'
32 break
33 else:
34 raise unittest.SkipTest, 'Could not open any shared libraries'
37 if __name__ == '__main__':
38 test_main()