3131from _pytest .fixtures import fixture
3232from _pytest .fixtures import FixtureRequest
3333from _pytest .main import Session
34- from _pytest .store import StoreKey
34+ from _pytest .stash import StashKey
3535from _pytest .terminal import TerminalReporter
3636
3737
3838DEFAULT_LOG_FORMAT = "%(levelname)-8s %(name)s:%(filename)s:%(lineno)d %(message)s"
3939DEFAULT_LOG_DATE_FORMAT = "%H:%M:%S"
4040_ANSI_ESCAPE_SEQ = re .compile (r"\x1b\[[\d;]+m" )
41- caplog_handler_key = StoreKey ["LogCaptureHandler" ]()
42- caplog_records_key = StoreKey [Dict [str , List [logging .LogRecord ]]]()
41+ caplog_handler_key = StashKey ["LogCaptureHandler" ]()
42+ caplog_records_key = StashKey [Dict [str , List [logging .LogRecord ]]]()
4343
4444
4545def _remove_ansi_escape_sequences (text : str ) -> str :
@@ -372,7 +372,7 @@ def handler(self) -> LogCaptureHandler:
372372
373373 :rtype: LogCaptureHandler
374374 """
375- return self ._item ._store [caplog_handler_key ]
375+ return self ._item .stash [caplog_handler_key ]
376376
377377 def get_records (self , when : str ) -> List [logging .LogRecord ]:
378378 """Get the logging records for one of the possible test phases.
@@ -385,7 +385,7 @@ def get_records(self, when: str) -> List[logging.LogRecord]:
385385
386386 .. versionadded:: 3.4
387387 """
388- return self ._item ._store [caplog_records_key ].get (when , [])
388+ return self ._item .stash [caplog_records_key ].get (when , [])
389389
390390 @property
391391 def text (self ) -> str :
@@ -694,8 +694,8 @@ def _runtest_for(self, item: nodes.Item, when: str) -> Generator[None, None, Non
694694 ) as report_handler :
695695 caplog_handler .reset ()
696696 report_handler .reset ()
697- item ._store [caplog_records_key ][when ] = caplog_handler .records
698- item ._store [caplog_handler_key ] = caplog_handler
697+ item .stash [caplog_records_key ][when ] = caplog_handler .records
698+ item .stash [caplog_handler_key ] = caplog_handler
699699
700700 yield
701701
@@ -707,7 +707,7 @@ def pytest_runtest_setup(self, item: nodes.Item) -> Generator[None, None, None]:
707707 self .log_cli_handler .set_when ("setup" )
708708
709709 empty : Dict [str , List [logging .LogRecord ]] = {}
710- item ._store [caplog_records_key ] = empty
710+ item .stash [caplog_records_key ] = empty
711711 yield from self ._runtest_for (item , "setup" )
712712
713713 @hookimpl (hookwrapper = True )
@@ -721,8 +721,8 @@ def pytest_runtest_teardown(self, item: nodes.Item) -> Generator[None, None, Non
721721 self .log_cli_handler .set_when ("teardown" )
722722
723723 yield from self ._runtest_for (item , "teardown" )
724- del item ._store [caplog_records_key ]
725- del item ._store [caplog_handler_key ]
724+ del item .stash [caplog_records_key ]
725+ del item .stash [caplog_handler_key ]
726726
727727 @hookimpl
728728 def pytest_runtest_logfinish (self ) -> None :
0 commit comments