Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 786e922

Browse files
Issue #25911: Tring to silence deprecation warnings in bytes path walk tests.
2 parents 706379a + ada6db7 commit 786e922

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

Lib/test/test_os.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,17 @@ def tearDown(self):
10201020

10211021
class BytesWalkTests(WalkTests):
10221022
"""Tests for os.walk() with bytes."""
1023+
def setUp(self):
1024+
super().setUp()
1025+
self.stack = contextlib.ExitStack()
1026+
if os.name == 'nt':
1027+
self.stack.enter_context(warnings.catch_warnings())
1028+
warnings.simplefilter("ignore", DeprecationWarning)
1029+
1030+
def tearDown(self):
1031+
self.stack.close()
1032+
super().tearDown()
1033+
10231034
def walk(self, top, **kwargs):
10241035
if 'follow_symlinks' in kwargs:
10251036
kwargs['followlinks'] = kwargs.pop('follow_symlinks')

0 commit comments

Comments
 (0)