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): |