Skip to content

Replace deprecated unittest aliases #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gitdb/test/db/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ def _assert_object_writing(self, db):
assert ostream.type == str_blob_type
assert ostream.size == len(data)
else:
self.failUnlessRaises(BadObject, db.info, sha)
self.failUnlessRaises(BadObject, db.stream, sha)
self.assertRaises(BadObject, db.info, sha)
self.assertRaises(BadObject, db.stream, sha)

# DIRECT STREAM COPY
# our data hase been written in object format to the StringIO
Expand Down
2 changes: 1 addition & 1 deletion gitdb/test/db/test_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_reading(self):
assert gdb.partial_to_complete_sha_hex(bin_to_hex(binsha)[:8 - (i % 2)]) == binsha
# END for each sha

self.failUnlessRaises(BadObject, gdb.partial_to_complete_sha_hex, "0000")
self.assertRaises(BadObject, gdb.partial_to_complete_sha_hex, "0000")

@with_rw_directory
def test_writing(self, path):
Expand Down
2 changes: 1 addition & 1 deletion gitdb/test/db/test_loose.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ def test_basics(self, path):
assert bin_to_hex(ldb.partial_to_complete_sha_hex(short_sha)) == long_sha
# END for each sha

self.failUnlessRaises(BadObject, ldb.partial_to_complete_sha_hex, '0000')
self.assertRaises(BadObject, ldb.partial_to_complete_sha_hex, '0000')
# raises if no object could be found
2 changes: 1 addition & 1 deletion gitdb/test/db/test_pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ def test_writing(self, path):
# assert num_ambiguous

# non-existing
self.failUnlessRaises(BadObject, pdb.partial_to_complete_sha, b'\0\0', 4)
self.assertRaises(BadObject, pdb.partial_to_complete_sha, b'\0\0', 4)
2 changes: 1 addition & 1 deletion gitdb/test/test_pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def _assert_index_file(self, index, version, size):
assert index.partial_sha_to_index(sha[:l], l * 2) == oidx

# END for each object index in indexfile
self.failUnlessRaises(ValueError, index.partial_sha_to_index, "\0", 2)
self.assertRaises(ValueError, index.partial_sha_to_index, "\0", 2)

def _assert_pack_file(self, pack, version, size):
assert pack.version() == 2
Expand Down
2 changes: 1 addition & 1 deletion gitdb/test/test_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def test_compressed_writer(self):
ostream.close()

# its closed already
self.failUnlessRaises(OSError, os.close, fd)
self.assertRaises(OSError, os.close, fd)

# read everything back, compare to data we zip
fd = os.open(path, os.O_RDONLY | getattr(os, 'O_BINARY', 0))
Expand Down
6 changes: 3 additions & 3 deletions gitdb/test/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def test_lockedfd(self):
lockfilepath = lfd._lockfilepath()

# cannot end before it was started
self.failUnlessRaises(AssertionError, lfd.rollback)
self.failUnlessRaises(AssertionError, lfd.commit)
self.assertRaises(AssertionError, lfd.rollback)
self.assertRaises(AssertionError, lfd.commit)

# open for writing
assert not os.path.isfile(lockfilepath)
Expand Down Expand Up @@ -77,7 +77,7 @@ def test_lockedfd(self):
wfdstream = lfd.open(write=True, stream=True) # this time as stream
assert os.path.isfile(lockfilepath)
# another one fails
self.failUnlessRaises(IOError, olfd.open)
self.assertRaises(IOError, olfd.open)

wfdstream.write(new_data.encode("ascii"))
lfd.commit()
Expand Down