Skip to content

Commit a5a21f9

Browse files
committed
Explicitly use disable_executor_loggin fixture
1 parent cca1617 commit a5a21f9

1 file changed

Lines changed: 10 additions & 11 deletions

File tree

tests/test_qthreadexec.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,18 @@
22
# © 2014 Mark Harviston <mark.harviston@gmail.com>
33
# © 2014 Arve Knudsen <arve.knudsen@gmail.com>
44
# BSD License
5+
import logging
56
import threading
67
import weakref
7-
import logging
88

99
import pytest
1010

1111
import qasync
1212

13-
1413
_TestObject = type("_TestObject", (object,), {})
1514

1615

17-
@pytest.fixture(autouse=True)
16+
@pytest.fixture
1817
def disable_executor_logging():
1918
"""
2019
When running under pytest, leftover LogRecord objects
@@ -74,7 +73,7 @@ def rec(a, *args, **kwargs):
7473
f.result()
7574

7675

77-
def test_no_stale_reference_as_argument(executor):
76+
def test_no_stale_reference_as_argument(executor, disable_executor_logging):
7877
test_obj = _TestObject()
7978
test_obj_collected = threading.Event()
8079

@@ -87,12 +86,12 @@ def test_no_stale_reference_as_argument(executor):
8786
future.result()
8887

8988
collected = test_obj_collected.wait(timeout=1)
90-
assert (
91-
collected is True
92-
), "Stale reference to executor argument not collected within timeout."
89+
assert collected is True, (
90+
"Stale reference to executor argument not collected within timeout."
91+
)
9392

9493

95-
def test_no_stale_reference_as_result(executor):
94+
def test_no_stale_reference_as_result(executor, disable_executor_logging):
9695
# Get object as result out of executor
9796
test_obj = executor.submit(lambda: _TestObject()).result()
9897
test_obj_collected = threading.Event()
@@ -102,6 +101,6 @@ def test_no_stale_reference_as_result(executor):
102101
del test_obj
103102

104103
collected = test_obj_collected.wait(timeout=1)
105-
assert (
106-
collected is True
107-
), "Stale reference to executor result not collected within timeout."
104+
assert collected is True, (
105+
"Stale reference to executor result not collected within timeout."
106+
)

0 commit comments

Comments
 (0)