Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions moler/asyncio_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,22 @@


current_process = psutil.Process()
if platform.system() == 'Linux':

# Check if RLIMIT_NOFILE is available in your psutil
# noinspection PyUnresolvedReferences
(max_open_files_limit_soft, max_open_files_limit_hard) = current_process.rlimit(psutil.RLIMIT_NOFILE)
else:
if platform.system() == 'Windows':
# https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/setmaxstdio?view=vs-2019
(max_open_files_limit_soft, max_open_files_limit_hard) = (510, 512) # TODO: any way on Win?
else:
# Unix (Linux, Darwin, BSD, ...): read the real RLIMIT_NOFILE via stdlib resource module.
import resource
(max_open_files_limit_soft, max_open_files_limit_hard) = resource.getrlimit(resource.RLIMIT_NOFILE)


def system_resources_usage():
if platform.system() == 'Linux':
curr_fds_open = current_process.num_fds()
else:
if platform.system() == 'Windows':
ofiles = current_process.open_files()
osockets = current_process.connections(kind="all")
curr_fds_open = len(ofiles) + len(osockets) # TODO: any better way on Win?
else:
curr_fds_open = current_process.num_fds()
curr_threads_nb = threading.active_count()
return curr_fds_open, curr_threads_nb

Expand Down
4 changes: 2 additions & 2 deletions moler/io/raw/terminal_no_fork.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ def __init__(
moler_connection: Connection,
cmd: str = "/bin/bash",
select_timeout: float = 0.002,
read_buffer_size: int = 4096,
read_buffer_size: int = 4096000,
first_prompt: str = r"[%$#\]]+",
target_prompt: str = r"moler_bash#",
set_prompt_cmd: str = 'unset PROMPT_COMMAND; export PS1="moler_bash# "\n',
dimensions: Tuple[int, int] = (100, 300),
dimensions: Tuple[int, int] = (1000, 3000),
terminal_delayafterclose: float = 0.2,
):
"""
Expand Down
2 changes: 0 additions & 2 deletions py3pytest.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
[pytest]
python_files = test_*.py py3test_*.py # testfiles running only under python3 start with py3test_
mccabe-complexity =
*.py 10
1 change: 0 additions & 1 deletion requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
pycodestyle
coveralls
pytest
pytest-mccabe
pytest-random
mock
pytest-cov
Expand Down
4 changes: 0 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[tool:pytest]
mccabe-complexity =
*.py 10

[pycodestyle]
count = True
ignore = E501
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

setup(
name='moler',
version='4.10.1',
version='4.10.50',
description='Moler is a library for working with terminals, mainly for automated tests', # Required
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down
8 changes: 5 additions & 3 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@


current_process = psutil.Process()
if platform.system() == 'Linux':
(max_open_files_limit_soft, max_open_files_limit_hard) = current_process.rlimit(psutil.RLIMIT_NOFILE)
else:
if platform.system() == 'Windows':
# https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/setmaxstdio?view=vs-2019
(max_open_files_limit_soft, max_open_files_limit_hard) = (510, 512) # TODO: any way on Win?
else:
# Unix (Linux, Darwin, BSD, ...): read the real RLIMIT_NOFILE via stdlib resource module.
import resource
(max_open_files_limit_soft, max_open_files_limit_hard) = resource.getrlimit(resource.RLIMIT_NOFILE)


def system_resources_usage():
Expand Down
Loading