Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Unified Diff: tests/presubmit_unittest.py

Issue 115881: warnings.catch_warnings() is only available on python 2.5 (Closed)
Patch Set: Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/presubmit_unittest.py
diff --git a/tests/presubmit_unittest.py b/tests/presubmit_unittest.py
index 7f5d57191cbe0fdb953150916445746552226065..32a3829ed0e1a62c6f15c0e25a10b1977b677cb6 100755
--- a/tests/presubmit_unittest.py
+++ b/tests/presubmit_unittest.py
@@ -21,7 +21,11 @@ import presubmit_canned_checks
class PresubmitTestsBase(unittest.TestCase):
"""Setups and tear downs the mocks but doesn't test anything as-is."""
def setUp(self):
- self._warnings_stack = warnings.catch_warnings()
+ if hasattr(warnings, 'catch_warnings'):
+ self._warnings_stack = warnings.catch_warnings()
+ else:
+ self._warnings_stack = None
+
warnings.simplefilter("ignore", DeprecationWarning)
self.original_IsFile = os.path.isfile
def MockIsFile(f):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698