(original) (raw)
changeset: 100466:757159fb4847 branch: 3.5 parent: 100464:f48b32bc3d0a user: Serhiy Storchaka storchaka@gmail.com date: Tue Mar 08 21:26:26 2016 +0200 files: Lib/test/test_os.py description: Issue #25911: Tring to silence deprecation warnings in bytes path walk tests. diff -r f48b32bc3d0a -r 757159fb4847 Lib/test/test_os.py --- a/Lib/test/test_os.py Tue Mar 08 21:15:43 2016 +0200 +++ b/Lib/test/test_os.py Tue Mar 08 21:26:26 2016 +0200 @@ -1021,6 +1021,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') /storchaka@gmail.com