diff options
author | Jon Dufresne <jon.dufresne@gmail.com> | 2018-09-16 17:20:15 -0700 |
---|---|---|
committer | Jon Dufresne <jon.dufresne@gmail.com> | 2018-09-16 17:53:48 -0700 |
commit | 89123d51895bdb828a7773228acc08b67d73255c (patch) | |
tree | d3cf128c2a02d17c44005396512cb4216c5b4116 /mock/tests/testmock.py | |
parent | 8c19ef6c95004524cb9f0b170a1aff6f47ade764 (diff) | |
download | mock-89123d51895bdb828a7773228acc08b67d73255c.tar.gz |
Drop dependency of unittest2; use stdlib unittest instead
Now that Python 2.6 support has been dropped (commit
b67fe8a6f55ba321b602740fdf0bf0d15f074f4f), can simply use Python
unittest. No unique features of unittest2 were in use that aren't also
available in the stdlib unittest. One less dependency.
Diffstat (limited to 'mock/tests/testmock.py')
-rw-r--r-- | mock/tests/testmock.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/mock/tests/testmock.py b/mock/tests/testmock.py index 66323e9..f7049c6 100644 --- a/mock/tests/testmock.py +++ b/mock/tests/testmock.py @@ -8,7 +8,7 @@ import sys import tempfile import six -import unittest2 as unittest +import unittest import mock from mock import ( @@ -205,7 +205,7 @@ class MockTest(unittest.TestCase): mock = create_autospec(f) mock.side_effect = ValueError('Bazinga!') - self.assertRaisesRegex(ValueError, 'Bazinga!', mock) + self.assertRaisesRegexp(ValueError, 'Bazinga!', mock) @unittest.skipUnless('java' in sys.platform, 'This test only applies to Jython') @@ -501,7 +501,7 @@ class MockTest(unittest.TestCase): # this should be allowed mock.something - self.assertRaisesRegex( + self.assertRaisesRegexp( AttributeError, "Mock object has no attribute 'something_else'", getattr, mock, 'something_else' @@ -520,12 +520,12 @@ class MockTest(unittest.TestCase): mock.x mock.y mock.__something__ - self.assertRaisesRegex( + self.assertRaisesRegexp( AttributeError, "Mock object has no attribute 'z'", getattr, mock, 'z' ) - self.assertRaisesRegex( + self.assertRaisesRegexp( AttributeError, "Mock object has no attribute '__foobar__'", getattr, mock, '__foobar__' @@ -591,13 +591,13 @@ class MockTest(unittest.TestCase): def test_assert_called_with_message(self): mock = Mock() - self.assertRaisesRegex(AssertionError, 'Not called', + self.assertRaisesRegexp(AssertionError, 'Not called', mock.assert_called_with) def test_assert_called_once_with_message(self): mock = Mock(name='geoffrey') - self.assertRaisesRegex(AssertionError, + self.assertRaisesRegexp(AssertionError, r"Expected 'geoffrey' to be called once\.", mock.assert_called_once_with) |