Partial revert of r80556 (Issue #7449, part 5, fix ctypes test)
Rewrite r80556: the thread test have to be executed just after the test on libc_open() and so the test cannot be splitted in two functions (without duplicating code, and I don't want to duplicate code).
This commit is contained in:
parent
a44b5a3326
commit
47c884129d
|
@ -7,11 +7,11 @@ try:
|
|||
except ImportError:
|
||||
threading = None
|
||||
|
||||
libc_name = find_library("c")
|
||||
|
||||
class Test(unittest.TestCase):
|
||||
@unittest.skipUnless(libc_name, 'Unable to find the C library')
|
||||
def test_open(self):
|
||||
libc_name = find_library("c")
|
||||
if libc_name is None:
|
||||
raise unittest.SkipTest("Unable to find C library")
|
||||
libc = CDLL(libc_name, use_errno=True)
|
||||
if os.name == "nt":
|
||||
libc_open = libc._open
|
||||
|
@ -26,11 +26,7 @@ class Test(unittest.TestCase):
|
|||
self.assertEqual(set_errno(32), errno.ENOENT)
|
||||
self.assertEqual(get_errno(), 32)
|
||||
|
||||
@unittest.skipUnless(libc_name, 'Unable to find the C library')
|
||||
@unittest.skipUnless(threading, 'This test requires threading.')
|
||||
def test_open_thread(self):
|
||||
self.assertEqual(set_errno(32), errno.ENOENT)
|
||||
|
||||
if threading:
|
||||
def _worker():
|
||||
set_errno(0)
|
||||
|
||||
|
|
Loading…
Reference in New Issue