changeset: 100467:ecf4e51c222f parent: 100465:0a749e651aa6 parent: 100466:757159fb4847 user: Serhiy Storchaka date: Tue Mar 08 21:26:44 2016 +0200 files: Lib/test/test_os.py description: Issue #25911: Tring to silence deprecation warnings in bytes path walk tests. diff -r 0a749e651aa6 -r ecf4e51c222f Lib/test/test_os.py --- a/Lib/test/test_os.py Tue Mar 08 21:16:47 2016 +0200 +++ b/Lib/test/test_os.py Tue Mar 08 21:26:44 2016 +0200 @@ -1020,6 +1020,17 @@ class BytesWalkTests(WalkTests): """Tests for os.walk() with bytes.""" + def setUp(self): + super().setUp() + self.stack = contextlib.ExitStack() + if os.name == 'nt': + self.stack.enter_context(warnings.catch_warnings()) + warnings.simplefilter("ignore", DeprecationWarning) + + def tearDown(self): + self.stack.close() + super().tearDown() + def walk(self, top, **kwargs): if 'follow_symlinks' in kwargs: kwargs['followlinks'] = kwargs.pop('follow_symlinks')