Skip to content

Commit 3713272

Browse files
committed
added warning and fix docs
1 parent e3e535e commit 3713272

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ The functionality of the classic context manager is also available.
2525

2626
- Optional parameters:
2727
- `assert_q_count`: The expected number of database requests is otherwise "AssertionError: N not less than or equal to N queries"
28-
- `number_runs`: The number of runs of the test function `_`
28+
- `number_runs`: The number of runs of the test function / test for loop
2929
- `verbose`: Displaying the final results of the test measurements
3030
- `advanced_verb`: Displaying the result of each test measurement
3131
- `auto_call_func`: Autorun of the decorated function (without arguments)

src/capture_db_queries/decorators.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@ def __enter__(self) -> Self:
9494
if self.debug:
9595
print('__enter__')
9696

97+
if self.number_runs > 1:
98+
warnings.warn(
99+
f'При использовании: {type(self).__name__} как контекстного менеджера'
100+
'параметр number_runs > 1 не используеться.',
101+
category=FutureWarning,
102+
stacklevel=2,
103+
)
97104
self.start = time.perf_counter()
98105
self._enter()
99106
return self
@@ -223,7 +230,7 @@ def test_request():
223230
224231
- assert_q_count: Ожидаемое количество запросов к БД иначе
225232
"AssertionError: N not less than or equal to N queries"
226-
- number_runs: Количество запусков тестовой функции `_`
233+
- number_runs: Количество запусков тестовой функции / тестового цикла
227234
- verbose: Отображение финальных результатов тестовых замеров
228235
- advanced_verb: Отображение результа каждого тестового замера
229236
- auto_call_func: Автозапуск декорируемой функции (без аргументов)

0 commit comments

Comments
 (0)