-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Labels
Description
Recently added (virtualenv 20.33.0
) test_too_many_open_files
fails:
========================================================= test session starts ==========================================================
platform linux -- Python 3.12.11, pytest-8.4.1, pluggy-1.6.0
cachedir: .tox/py3/.pytest_cache
Using --randomly-seed=2669281539
rootdir: /usr/src/RPM/BUILD/python3-module-virtualenv-20.33.0
configfile: pyproject.toml
plugins: time-machine-2.16.0, env-1.1.5, mock-3.14.1, randomly-3.16.0, timeout-2.4.0, flaky-3.8.1
timeout: 600.0s
timeout method: signal
timeout func_only: False
collected 1 item
tests/unit/test_file_limit.py F [100%]
=============================================================== FAILURES ===============================================================
_______________________________________________________ test_too_many_open_files _______________________________________________________
tmp_path = PosixPath('/usr/src/tmp/pytest-of-builder/pytest-12/test_too_many_open_files0')
@pytest.mark.skipif(sys.platform == "win32", reason="resource module not available on Windows")
def test_too_many_open_files(tmp_path):
"""
Test that we get a specific error message when we have too many open files.
"""
import resource # noqa: PLC0415
soft_limit, hard_limit = resource.getrlimit(resource.RLIMIT_NOFILE)
if soft_limit > 1024:
pytest.skip("soft limit for open files is too high to reliably trigger the error")
# Lower the soft limit to a small number to trigger the error
try:
resource.setrlimit(resource.RLIMIT_NOFILE, (32, hard_limit))
except ValueError:
pytest.skip("could not lower the soft limit for open files")
# Keep some file descriptors open to make it easier to trigger the error
fds = []
try:
fds.extend(os.open(os.devnull, os.O_RDONLY) for _ in range(20))
with pytest.raises(SystemExit) as excinfo:
> cli_run([str(tmp_path / "venv")])
excinfo = <ExceptionInfo for raises contextmanager>
fd = 30
fds = [11, 12, 13, 14, 15, 16, ...]
hard_limit = 524288
resource = <module 'resource' from '/usr/lib64/python3.12/lib-dynload/resource.cpython-312.so'>
soft_limit = 1024
tmp_path = PosixPath('/usr/src/tmp/pytest-of-builder/pytest-12/test_too_many_open_files0')
tests/unit/test_file_limit.py:34:
...
cls = <class 'virtualenv.discovery.py_info.PythonInfo'>
app_data = AppDataDiskFolder(/usr/src/tmp/pytest-of-builder/pytest-12/session-app-data0)
exe = '/usr/src/RPM/BUILD/python3-module-virtualenv-20.33.0/.tox/py3/bin/python'
env = environ({'HOME': '/usr/src', 'TMPDIR': '/usr/src/tmp', 'TERM': 'xterm', 'PATH': '/usr/src/RPM/BUILD/python3-module-vir...p/pytest-of-builder/pytest-12/session-app-data0', 'VIRTUALENV_NO_PERIODIC_UPDATE': '1', 'VIRTUALENV_NO_DOWNLOAD': '1'})
raise_on_error = True, ignore_cache = False
def from_exe(cls, app_data, exe, env=None, raise_on_error=True, ignore_cache=False): # noqa: FBT002, PLR0913
env = os.environ if env is None else env
result = _get_from_cache(cls, app_data, exe, env, ignore_cache=ignore_cache)
if isinstance(result, Exception):
if raise_on_error:
> raise result
E RuntimeError: failed to query /usr/src/RPM/BUILD/python3-module-virtualenv-20.33.0/.tox/py3/bin/python with code 24 err: 'Too many open files'
app_data = AppDataDiskFolder(/usr/src/tmp/pytest-of-builder/pytest-12/session-app-data0)
cls = <class 'virtualenv.discovery.py_info.PythonInfo'>
env = environ({'HOME': '/usr/src', 'TMPDIR': '/usr/src/tmp', 'TERM': 'xterm', 'PATH': '/usr/src/RPM/BUILD/python3-module-vir...p/pytest-of-builder/pytest-12/session-app-data0', 'VIRTUALENV_NO_PERIODIC_UPDATE': '1', 'VIRTUALENV_NO_DOWNLOAD': '1'})
exe = '/usr/src/RPM/BUILD/python3-module-virtualenv-20.33.0/.tox/py3/bin/python'
ignore_cache = False
raise_on_error = True
result = RuntimeError("failed to query /usr/src/RPM/BUILD/python3-module-virtualenv-20.33.0/.tox/py3/bin/python with code 24 err: 'Too many open files'")
.tox/py3/lib/python3/site-packages/virtualenv/discovery/cached_py_info.py:35: RuntimeError