diff options
author | Harmon <Harmon758@gmail.com> | 2020-02-16 16:51:49 -0600 |
---|---|---|
committer | Harmon <Harmon758@gmail.com> | 2020-02-16 16:51:49 -0600 |
commit | eca69510d250f4e69c43a230610b0ed2bd23a2e7 (patch) | |
tree | 687f333cbf5e25c61933d9bc0589ad4c5ea41a7f | |
parent | c8c63abb360b4829b3d75d60fb837c0132db0510 (diff) | |
download | gitpython-eca69510d250f4e69c43a230610b0ed2bd23a2e7.tar.gz |
Replace raises with assertRaises
-rw-r--r-- | git/test/lib/asserts.py | 3 | ||||
-rw-r--r-- | git/test/test_git.py | 7 | ||||
-rw-r--r-- | git/test/test_repo.py | 9 |
3 files changed, 6 insertions, 13 deletions
diff --git a/git/test/lib/asserts.py b/git/test/lib/asserts.py index d9673147..0e7592c0 100644 --- a/git/test/lib/asserts.py +++ b/git/test/lib/asserts.py @@ -7,9 +7,8 @@ from unittest.mock import patch from nose.tools import ( - raises, # @UnusedImport assert_true, # @UnusedImport assert_false # @UnusedImport ) -__all__ = ['patch', 'raises', 'assert_true', 'assert_false'] +__all__ = ['patch', 'assert_true', 'assert_false'] diff --git a/git/test/test_git.py b/git/test/test_git.py index ccee5f3c..69e8b0b4 100644 --- a/git/test/test_git.py +++ b/git/test/test_git.py @@ -22,7 +22,6 @@ from git.compat import is_darwin from git.test.lib import ( TestBase, patch, - raises, assert_true, fixture_path ) @@ -62,9 +61,8 @@ class TestGit(TestBase): mangled_value = 'Unicode\u20ac\u2122' self.assertEqual(args, ['git', 'log', '--', mangled_value]) - @raises(GitCommandError) def test_it_raises_errors(self): - self.git.this_does_not_exist() + self.assertRaises(GitCommandError, self.git.this_does_not_exist) def test_it_transforms_kwargs_into_git_command_arguments(self): self.assertEqual(["-s"], self.git.transform_kwargs(**{'s': True})) @@ -99,10 +97,9 @@ class TestGit(TestBase): self.git.version(pass_this_kwarg=False) assert_true("pass_this_kwarg" not in git.call_args[1]) - @raises(GitCommandError) def test_it_raises_proper_exception_with_output_stream(self): tmp_file = TemporaryFile() - self.git.checkout('non-existent-branch', output_stream=tmp_file) + self.assertRaises(GitCommandError, self.git.checkout, 'non-existent-branch', output_stream=tmp_file) def test_it_accepts_environment_variables(self): filename = fixture_path("ls_tree_empty") diff --git a/git/test/test_repo.py b/git/test/test_repo.py index c37fd744..a3fff4a8 100644 --- a/git/test/test_repo.py +++ b/git/test/test_repo.py @@ -42,8 +42,7 @@ from git.test.lib import ( with_rw_repo, fixture, assert_false, - assert_true, - raises + assert_true ) from git.util import HIDE_WINDOWS_KNOWN_ERRORS, cygpath from git.test.lib import with_rw_directory @@ -82,13 +81,11 @@ class TestRepo(TestBase): import gc gc.collect() - @raises(InvalidGitRepositoryError) def test_new_should_raise_on_invalid_repo_location(self): - Repo(tempfile.gettempdir()) + self.assertRaises(InvalidGitRepositoryError, Repo, tempfile.gettempdir()) - @raises(NoSuchPathError) def test_new_should_raise_on_non_existent_path(self): - Repo("repos/foobar") + self.assertRaises(NoSuchPathError, Repo, "repos/foobar") @with_rw_repo('0.3.2.1') def test_repo_creation_from_different_paths(self, rw_repo): |