Skip to content

Commit c933487

Browse files
authored
Apply suggestions from code review
1 parent baab6a3 commit c933487

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Lib/test/support/os_helper.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,12 @@ def _waitfor(func, pathname, waitall=False):
379379
# Increase the timeout and try again
380380
time.sleep(timeout)
381381
timeout *= 2
382-
logging.getLogger(__name__).warning('tests may fail, delete still pending for %s', pathname)
382+
logging.getLogger(__name__).warning(
383+
'tests may fail, delete still pending for %s',
384+
pathname,
385+
stack_info=True,
386+
stacklevel=4,
387+
)
383388

384389
def _unlink(filename):
385390
_waitfor(os.unlink, filename)
@@ -494,11 +499,13 @@ def temp_dir(path=None, quiet=False):
494499
except OSError as exc:
495500
if not quiet:
496501
raise
497-
logger.getLogger(__name__).warning(
502+
logging.getLogger(__name__).warning(
498503
"tests may fail, unable to create temporary directory %r: %s",
499504
path,
500505
exc,
501506
exc_info=exc,
507+
stack_info=True,
508+
stacklevel=3,
502509
)
503510
if dir_created:
504511
pid = os.getpid()
@@ -536,6 +543,8 @@ def change_cwd(path, quiet=False):
536543
path,
537544
exc,
538545
exc_info=exc,
546+
stack_info=True,
547+
stacklevel=3,
539548
)
540549
try:
541550
yield os.getcwd()

0 commit comments

Comments
 (0)