Skip to content

Commit

Permalink
tests: isolated: adjust expected file descriptors increase for python…
Browse files Browse the repository at this point in the history
… 3.13

It looks like that with python 3.13, the increase in number of
opened file descriptors in `test_pipe_leakage` on Windows is
down from 6 to 3. Adjust the value for now, will investigate
later.
  • Loading branch information
rokm committed May 15, 2024
1 parent 009c2ba commit 6983548
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/unit/test_isolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import pytest

from PyInstaller import isolated
from PyInstaller import compat
from PyInstaller.utils.tests import requires


Expand Down Expand Up @@ -179,7 +180,7 @@ def test_pipe_leakage():
parent = Process()

# Get this platform's *count open handles* method.
open_fds = parent.num_handles if os.name == "nt" else parent.num_fds
open_fds = parent.num_handles if compat.is_win else parent.num_fds
old = open_fds()

# Creating an isolated.Python() does nothing.
Expand All @@ -193,8 +194,12 @@ def test_pipe_leakage():
# opened when the sub-process is spawned. Then we close the two pipe end-points that were inherited by the child,
# which closes two handles. Finally, we open file descriptors on the remaining two pipe end-point handles, and
# perform os.fdopen() on those FDs to obtained buffered python "file" object. This adds two additional file
# handles, bringing us to the total of six.
EXPECTED_INCREASE_IN_FDS = (2 if os.name != "nt" else 6)
# handles, bringing us to the total of six. Starting with python 3.13, the increase seems to be down to three,
# instead.
if compat.is_win:
EXPECTED_INCREASE_IN_FDS = 3 if compat.is_py313 else 6
else:
EXPECTED_INCREASE_IN_FDS = 2

with child:
assert open_fds() == old + EXPECTED_INCREASE_IN_FDS
Expand Down

0 comments on commit 6983548

Please sign in to comment.