]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #25911: Tring to silence deprecation warnings in bytes path walk tests.
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 8 Mar 2016 19:26:26 +0000 (21:26 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Tue, 8 Mar 2016 19:26:26 +0000 (21:26 +0200)
Lib/test/test_os.py

index 73db39c8258e915cfbc43eb9b57114b7a0d686a8..66f563465fe3f9c32d3d6fc02c6cdd854da00797 100644 (file)
@@ -1021,6 +1021,17 @@ class FwalkTests(WalkTests):
 
 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')