[llvm] r350308 - Python compat - assertRaisesRegex
Serge Guelton via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 3 06:11:42 PST 2019
Author: serge_sans_paille
Date: Thu Jan 3 06:11:41 2019
New Revision: 350308
URL: http://llvm.org/viewvc/llvm-project?rev=350308&view=rev
Log:
Python compat - assertRaisesRegex
Python3 uses assertRaisesRegex instad of assertRaisesRegexp.
Differential Revision: https://reviews.llvm.org/D56251
Modified:
llvm/trunk/bindings/python/llvm/tests/base.py
llvm/trunk/bindings/python/llvm/tests/test_disassembler.py
Modified: llvm/trunk/bindings/python/llvm/tests/base.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/python/llvm/tests/base.py?rev=350308&r1=350307&r2=350308&view=diff
==============================================================================
--- llvm/trunk/bindings/python/llvm/tests/base.py (original)
+++ llvm/trunk/bindings/python/llvm/tests/base.py Thu Jan 3 06:11:41 2019
@@ -1,6 +1,8 @@
import os.path
+import sys
import unittest
+
POSSIBLE_TEST_BINARIES = [
'libreadline.so.5',
'libreadline.so.6',
@@ -15,6 +17,9 @@ POSSIBLE_TEST_BINARY_PATHS = [
]
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.
Modified: llvm/trunk/bindings/python/llvm/tests/test_disassembler.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/python/llvm/tests/test_disassembler.py?rev=350308&r1=350307&r2=350308&view=diff
==============================================================================
--- llvm/trunk/bindings/python/llvm/tests/test_disassembler.py (original)
+++ llvm/trunk/bindings/python/llvm/tests/test_disassembler.py Thu Jan 3 06:11:41 2019
@@ -19,7 +19,7 @@ class TestDisassembler(TestBase):
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):
More information about the llvm-commits
mailing list