Skip to content

Commit c8c63ab

Browse files
committed
Replace assert_raises with assertRaises
1 parent 24d04e8 commit c8c63ab

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

git/test/lib/asserts.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@
77
from unittest.mock import patch
88

99
from nose.tools import (
10-
assert_raises, # @UnusedImport
1110
raises, # @UnusedImport
1211
assert_true, # @UnusedImport
1312
assert_false # @UnusedImport
1413
)
1514

16-
__all__ = ['assert_raises', 'patch', 'raises',
17-
'assert_true', 'assert_false']
15+
__all__ = ['patch', 'raises', 'assert_true', 'assert_false']

git/test/test_base.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
from git.objects.util import get_object_type_by_name
2020
from git.test.lib import (
2121
TestBase,
22-
assert_raises,
2322
with_rw_repo,
2423
with_rw_and_rw_remote_repo
2524
)
@@ -96,7 +95,7 @@ def test_get_object_type_by_name(self):
9695
assert base.Object in get_object_type_by_name(tname).mro()
9796
# END for each known type
9897

99-
assert_raises(ValueError, get_object_type_by_name, b"doesntexist")
98+
self.assertRaises(ValueError, get_object_type_by_name, b"doesntexist")
10099

101100
def test_object_resolution(self):
102101
# objects must be resolved to shas so they compare equal

git/test/test_remote.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
with_rw_repo,
2828
with_rw_and_rw_remote_repo,
2929
fixture,
30-
GIT_DAEMON_PORT,
31-
assert_raises
30+
GIT_DAEMON_PORT
3231
)
3332
from git.util import rmtree, HIDE_WINDOWS_FREEZE_ERRORS
3433
import os.path as osp
@@ -626,7 +625,7 @@ def test_multiple_urls(self, rw_repo):
626625
self.assertEqual(list(remote.urls), [test1, test2])
627626

628627
# will raise: fatal: --add --delete doesn't make sense
629-
assert_raises(GitCommandError, remote.set_url, test2, add=True, delete=True)
628+
self.assertRaises(GitCommandError, remote.set_url, test2, add=True, delete=True)
630629

631630
# Testing on another remote, with the add/delete URL
632631
remote = rw_repo.create_remote('another', url=test1)
@@ -640,7 +639,7 @@ def test_multiple_urls(self, rw_repo):
640639
remote.delete_url(test1)
641640
self.assertEqual(list(remote.urls), [test3])
642641
# will raise fatal: Will not delete all non-push URLs
643-
assert_raises(GitCommandError, remote.delete_url, test3)
642+
self.assertRaises(GitCommandError, remote.delete_url, test3)
644643

645644
def test_fetch_error(self):
646645
rem = self.rorepo.remote('origin')

0 commit comments

Comments
 (0)