Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 28, 2025
1 parent c09a120 commit f317e84
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,30 +48,40 @@ class TestDbBackend(Enum):

@pytest.fixture(scope='module', autouse=True)
def log_module_open_fds(request):
import psutil, os
import os

import psutil

def list_open_fds():
process = psutil.Process(os.getpid())
return process.open_files()

open_fds = list_open_fds()
test_name = request.node.name

msg = f'{test_name} open fds: {len(open_fds)}\n'
with (Path.cwd() / "module_open_fds.log").open("a") as file_handler:
with (Path.cwd() / 'module_open_fds.log').open('a') as file_handler:
file_handler.write(msg)


@pytest.fixture(scope='function', autouse=True)
def log_function_open_fds(request):
import psutil, os
import os

import psutil

def list_open_fds():
process = psutil.Process(os.getpid())
return process.open_files()

open_fds = list_open_fds()
test_name = request.node.name

msg = f'{test_name} open fds: {len(open_fds)}\n'
with (Path.cwd() / "function_open_fds.log").open("a") as file_handler:
with (Path.cwd() / 'function_open_fds.log').open('a') as file_handler:
file_handler.write(msg)


def pytest_collection_modifyitems(items, config):
"""Automatically generate markers for certain tests.
Expand Down

0 comments on commit f317e84

Please sign in to comment.