summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Eßer <se@FreeBSD.org>2021-09-22 17:11:46 +0200
committerStefan Eßer <se@FreeBSD.org>2021-09-22 17:11:46 +0200
commitb717990ac74691f2081f4ab0c63d8829db9e8fa1 (patch)
treea30d33c1a81233b404ce9323809a633584ba8e5c
parenta48c3021c4c4cffc537122ac14d2c340ae75ad62 (diff)
downloadpexpect-b717990ac74691f2081f4ab0c63d8829db9e8fa1.tar.gz
Replace deprecated assertRaisesRegexp with assertRaisesRegex
The assertRaisesRegexp function appeared in Python-3.1 and was renamed to assertRaisesRegex in Python-3.2.
-rw-r--r--tests/PexpectTestCase.py2
-rwxr-xr-xtests/test_expect.py8
-rwxr-xr-xtests/test_misc.py4
-rw-r--r--tests/test_popen_spawn.py8
4 files changed, 11 insertions, 11 deletions
diff --git a/tests/PexpectTestCase.py b/tests/PexpectTestCase.py
index 307437e..5d7a168 100644
--- a/tests/PexpectTestCase.py
+++ b/tests/PexpectTestCase.py
@@ -97,7 +97,7 @@ class PexpectTestCase(unittest.TestCase):
raise AssertionError("%s was not raised" % excClass)
@contextlib.contextmanager
- def assertRaisesRegexp(self, excClass, pattern):
+ def assertRaisesRegex(self, excClass, pattern):
import re
try:
yield
diff --git a/tests/test_expect.py b/tests/test_expect.py
index c9087f4..5553d28 100755
--- a/tests/test_expect.py
+++ b/tests/test_expect.py
@@ -569,13 +569,13 @@ class ExpectTestCase (PexpectTestCase.PexpectTestCase):
def test_bad_arg(self):
p = pexpect.spawn('cat')
- with self.assertRaisesRegexp(TypeError, '.*must be one of'):
+ with self.assertRaisesRegex(TypeError, '.*must be one of'):
p.expect(1)
- with self.assertRaisesRegexp(TypeError, '.*must be one of'):
+ with self.assertRaisesRegex(TypeError, '.*must be one of'):
p.expect([1, b'2'])
- with self.assertRaisesRegexp(TypeError, '.*must be one of'):
+ with self.assertRaisesRegex(TypeError, '.*must be one of'):
p.expect_exact(1)
- with self.assertRaisesRegexp(TypeError, '.*must be one of'):
+ with self.assertRaisesRegex(TypeError, '.*must be one of'):
p.expect_exact([1, b'2'])
def test_timeout_none(self):
diff --git a/tests/test_misc.py b/tests/test_misc.py
index 7784759..3dc2b6e 100755
--- a/tests/test_misc.py
+++ b/tests/test_misc.py
@@ -214,7 +214,7 @@ class TestCaseMisc(PexpectTestCase.PexpectTestCase):
# Force an invalid state to test isalive
child.ptyproc.terminated = 0
try:
- with self.assertRaisesRegexp(pexpect.ExceptionPexpect,
+ with self.assertRaisesRegex(pexpect.ExceptionPexpect,
".*" + expect_errmsg):
child.isalive()
finally:
@@ -224,7 +224,7 @@ class TestCaseMisc(PexpectTestCase.PexpectTestCase):
def test_bad_arguments_suggest_fdpsawn(self):
" assert custom exception for spawn(int). "
expect_errmsg = "maybe you want to use fdpexpect.fdspawn"
- with self.assertRaisesRegexp(pexpect.ExceptionPexpect,
+ with self.assertRaisesRegex(pexpect.ExceptionPexpect,
".*" + expect_errmsg):
pexpect.spawn(1)
diff --git a/tests/test_popen_spawn.py b/tests/test_popen_spawn.py
index fca7493..10d7032 100644
--- a/tests/test_popen_spawn.py
+++ b/tests/test_popen_spawn.py
@@ -110,13 +110,13 @@ class ExpectTestCase (PexpectTestCase.PexpectTestCase):
def test_bad_arg(self):
p = PopenSpawn('cat')
- with self.assertRaisesRegexp(TypeError, '.*must be one of'):
+ with self.assertRaisesRegex(TypeError, '.*must be one of'):
p.expect(1)
- with self.assertRaisesRegexp(TypeError, '.*must be one of'):
+ with self.assertRaisesRegex(TypeError, '.*must be one of'):
p.expect([1, b'2'])
- with self.assertRaisesRegexp(TypeError, '.*must be one of'):
+ with self.assertRaisesRegex(TypeError, '.*must be one of'):
p.expect_exact(1)
- with self.assertRaisesRegexp(TypeError, '.*must be one of'):
+ with self.assertRaisesRegex(TypeError, '.*must be one of'):
p.expect_exact([1, b'2'])
def test_timeout_none(self):