summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_test_support.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_test_support.py')
-rw-r--r--Lib/test/test_test_support.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_test_support.py b/Lib/test/test_test_support.py
index 421a9ef..60476b7 100644
--- a/Lib/test/test_test_support.py
+++ b/Lib/test/test_test_support.py
@@ -417,6 +417,17 @@ class TestSupport(unittest.TestCase):
self.assertTrue(support.match_test(test_access))
self.assertFalse(support.match_test(test_chdir))
+ def test_fd_count(self):
+ # We cannot test the absolute value of fd_count(): on old Linux
+ # kernel or glibc versions, os.urandom() keeps a FD open on
+ # /dev/urandom device and Python has 4 FD opens instead of 3.
+ start = support.fd_count()
+ fd = os.open(__file__, os.O_RDONLY)
+ try:
+ more = support.fd_count()
+ finally:
+ os.close(fd)
+ self.assertEqual(more - start, 1)
# XXX -follows a list of untested API
# make_legacy_pyc