Python3 uses assertRaisesRegex instad of assertRaisesRegexp.
Differential Revision: https://reviews.llvm.org/D56251
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350308
91177308-0d34-0410-b5e6-
96231b3b80d8
import os.path
+import sys
import unittest
+
POSSIBLE_TEST_BINARIES = [
'libreadline.so.5',
'libreadline.so.6',
]
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.
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):