summaryrefslogtreecommitdiff
path: root/testing/logging
diff options
context:
space:
mode:
authorRan Benita <ran@unusedvar.com>2020-05-17 14:58:04 +0300
committerRan Benita <ran@unusedvar.com>2020-05-17 20:42:05 +0300
commitac6c02f1e2229d78609dede5ad96a0a72bdefdc7 (patch)
treea8467d313edbea7506d5f52fe245564cb493d86f /testing/logging
parentd4dfe863c974654fe333eb8368922c96175ede6c (diff)
downloadpytest-ac6c02f1e2229d78609dede5ad96a0a72bdefdc7.tar.gz
logging: use item's store for private attributes
This makes things type-safe and properly private.
Diffstat (limited to 'testing/logging')
-rw-r--r--testing/logging/test_fixture.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/testing/logging/test_fixture.py b/testing/logging/test_fixture.py
index c68866bef..a33b0e80e 100644
--- a/testing/logging/test_fixture.py
+++ b/testing/logging/test_fixture.py
@@ -1,6 +1,7 @@
import logging
import pytest
+from _pytest.logging import catch_log_handlers_key
logger = logging.getLogger(__name__)
sublogger = logging.getLogger(__name__ + ".baz")
@@ -136,4 +137,4 @@ def test_caplog_captures_for_all_stages(caplog, logging_during_setup_and_teardow
assert [x.message for x in caplog.get_records("setup")] == ["a_setup_log"]
# This reaches into private API, don't use this type of thing in real tests!
- assert set(caplog._item.catch_log_handlers.keys()) == {"setup", "call"}
+ assert set(caplog._item._store[catch_log_handlers_key]) == {"setup", "call"}