[PATCH] D56251: python compat - assertraisesregex

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 3 06:16:24 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL350308: Python compat - assertRaisesRegex (authored by serge_sans_paille, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D56251?vs=180045&id=180053#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56251/new/

https://reviews.llvm.org/D56251

Files:
  llvm/trunk/bindings/python/llvm/tests/base.py
  llvm/trunk/bindings/python/llvm/tests/test_disassembler.py


Index: llvm/trunk/bindings/python/llvm/tests/test_disassembler.py
===================================================================
--- llvm/trunk/bindings/python/llvm/tests/test_disassembler.py
+++ llvm/trunk/bindings/python/llvm/tests/test_disassembler.py
@@ -19,7 +19,7 @@
         self.assertEqual(s, '\tjcxz\t-127')
 
     def test_nonexistent_triple(self):
-        with self.assertRaisesRegexp(Exception, "Could not obtain disassembler for triple"):
+        with self.assertRaisesRegex(Exception, "Could not obtain disassembler for triple"):
             Disassembler("nonexistent-triple-raises")
 
     def test_get_instructions(self):
Index: llvm/trunk/bindings/python/llvm/tests/base.py
===================================================================
--- llvm/trunk/bindings/python/llvm/tests/base.py
+++ llvm/trunk/bindings/python/llvm/tests/base.py
@@ -1,6 +1,8 @@
 import os.path
+import sys
 import unittest
 
+
 POSSIBLE_TEST_BINARIES = [
     'libreadline.so.5',
     'libreadline.so.6',
@@ -15,6 +17,9 @@
 ]
 
 class TestBase(unittest.TestCase):
+    if sys.version_info.major == 2:
+        assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
+
     def get_test_binary(self):
         """Helper to obtain a test binary for object file testing.
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56251.180053.patch
Type: text/x-patch
Size: 1277 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190103/60b65832/attachment.bin>


More information about the llvm-commits mailing list