]> git.ipfire.org Git - thirdparty/Python/cpython.git/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 15:57:20 +0000 (08:57 -0700)
committerGitHub <noreply@github.com>
Wed, 6 Jun 2018 15:57:20 +0000 (08:57 -0700)
commit016aff77cbf5f63ed051a98ac628522a1cfd40a4
tree8ec40c311c2816008dd2255e08fa66f84b8c5c61
parent5c022f13ab6db8929e092ad035b3dc61701e3198
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