[Python-checkins] cpython (3.5): Issue #25911: Tring to silence deprecation warnings in bytes path walk tests.

serhiy.storchaka python-checkins at python.org
Tue Mar 8 14:32:03 EST 2016


https://hg.python.org/cpython/rev/757159fb4847
changeset:   100466:757159fb4847
branch:      3.5
parent:      100464:f48b32bc3d0a
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Tue Mar 08 21:26:26 2016 +0200
summary:
  Issue #25911: Tring to silence deprecation warnings in bytes path walk tests.

files:
  Lib/test/test_os.py |  11 +++++++++++
  1 files changed, 11 insertions(+), 0 deletions(-)


diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -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')

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list