]> granicus.if.org Git - python/commit
bpo-33773: Fix test.support.fd_count() on Linux/FreBSD (GH-7421)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 6 Jun 2018 16:09:18 +0000 (09:09 -0700)
committerGitHub <noreply@github.com>
Wed, 6 Jun 2018 16:09:18 +0000 (09:09 -0700)
commit97fe1b493df979956c66c57095bc7fce22104faf
treec3661a165c27142dde0b93453bac4318632eedd0
parent2bc1946fb02e140f5f5ac21a1afa2763615ad16b
bpo-33773: Fix test.support.fd_count() on Linux/FreBSD (GH-7421)

Substract one because listdir() opens internally a file
descriptor to list the content of the /proc/self/fd/ directory.

Add test_support.test_fd_count().

Move also MAXFD code before msvcrt.CrtSetReportMode(), to make sure
that the report mode is always restored on failure.
(cherry picked from commit 492d6424a7ca907c8ec1df21e51062e8f3d88e32)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
Lib/test/support/__init__.py
Lib/test/test_support.py