Pytest не работает: слишком много открытых файловPython

Программы на Python
Anonymous
Pytest не работает: слишком много открытых файлов

Сообщение Anonymous »

Я столкнулся с очень странной проблемой:
когда я запускаю наши тесты Python с помощью pytest, он начинает давать сбой, а в журнале ниже указано, что открыто слишком много файлов.
Я погуглил, но не нашел решения и не знаю, что вызывает такое поведение
Может ли кто-нибудь мне помочь (даже если вам нужна дополнительная информация, пожалуйста) дайте мне знать).
pytest -vvvv --setup-show tests
=========================================================================================== test session starts ===========================================================================================
platform linux -- Python 3.8.10, pytest-8.3.2, pluggy-1.5.0 --
/.env/bin/python3
cachedir: .pytest_cache
rootdir:
plugins: cov-5.0.0
collected 135 items / 3 errors

================================================================================================= ERRORS ==================================================================================================
________________________________________________________________________ ERROR collecting tests/functional/test_user_functional.py ________________________________________________________________________
/usr/lib/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
:1014: in _gcd_import
???
:991: in _find_and_load
???
:975: in _find_and_load_unlocked
???
:671: in _load_unlocked
???
.env/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:165: in exec_module
source_stat, co = _rewrite_test(fn, self.config)
.env/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:343: in _rewrite_test
source = fn.read_bytes()
/usr/lib/python3.8/pathlib.py:1229: in read_bytes
???
/usr/lib/python3.8/pathlib.py:1222: in open
???
/usr/lib/python3.8/pathlib.py:1078: in _opener
???
E OSError: [Errno 24] Too many open files: '/functional/test_user_functional.py'
____________________________________________________________________________________ ERROR collecting tests/test_data _____________________________________________________________________________________
.env/lib/python3.8/site-packages/_pytest/runner.py:341: in from_call
result: TResult | None = func()
.env/lib/python3.8/site-packages/_pytest/runner.py:389: in collect
return list(collector.collect())
.env/lib/python3.8/site-packages/_pytest/main.py:523: in collect
for direntry in scandir(self.path):
.env/lib/python3.8/site-packages/_pytest/pathlib.py:885: in scandir
with os.scandir(path) as s:
E OSError: [Errno 24] Too many open files: '/test_data'
_______________________________________________________________________________________ ERROR collecting tests/unit _______________________________________________________________________________________
.env/lib/python3.8/site-packages/_pytest/runner.py:341: in from_call
result: TResult | None = func()
.env/lib/python3.8/site-packages/_pytest/runner.py:389: in collect
return list(collector.collect())
.env/lib/python3.8/site-packages/_pytest/main.py:523: in collect
for direntry in scandir(self.path):
.env/lib/python3.8/site-packages/_pytest/pathlib.py:885: in scandir
with os.scandir(path) as s:
E OSError: [Errno 24] Too many open files: '/unit'
============================================================================================ warnings summary =============================================================================================
.env/lib/python3.8/site-packages/pydantic/_internal/_fields.py:201
/.env/lib/python3.8/site-packages/pydantic/_internal/_fields.py:201: UserWarning: Field name "schema" in "SnowflakeConnectModel" shadows an attribute in parent "BaseModel"

-- Docs: https://docs.pytest.org/en/stable/how-t ... nings.html
========================================================================================= short test summary info =========================================================================================
ERROR tests/functional/test_user_functional.py - OSError: [Errno 24] Too many open files: '/functional/test_user_functional.py'
ERROR tests/test_data - OSError: [Errno 24] Too many open files: '/test_data'
ERROR tests/unit - OSError: [Errno 24] Too many open files: '/unit'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 3 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
====================================================================================== 1 warning, 3 errors in 3.06s =======================================================================================


ulimit вывода:
ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 29053
max locked memory (kbytes, -l) 65536
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 29053
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited


Подробнее здесь: https://stackoverflow.com/questions/788 ... open-files

Вернуться в «Python»