Skip to content

Commit

Permalink
test: clean up
Browse files Browse the repository at this point in the history
Remove the temporary files and directories we create as part of running
the test suite.
  • Loading branch information
carlosmn committed Feb 11, 2014
1 parent fa7d240 commit 1f3c017
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
11 changes: 5 additions & 6 deletions test/test_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import tempfile

import pygit2
from pygit2 import Repository
from . import utils


Expand Down Expand Up @@ -154,12 +155,10 @@ def test_change_attributes(self):
self.assertEqual(pygit2.GIT_FILEMODE_BLOB_EXECUTABLE, entry.mode)

def test_write_tree_to(self):
path = tempfile.mkdtemp()
pygit2.init_repository(path)
nrepo = pygit2.Repository(path)

id = self.repo.index.write_tree(nrepo)
self.assertNotEqual(None, nrepo[id])
with utils.TemporaryRepository(('tar', 'emptyrepo')) as path:
nrepo = Repository(path)
id = self.repo.index.write_tree(nrepo)
self.assertNotEqual(None, nrepo[id])

class IndexEntryTest(utils.RepoTestCase):

Expand Down
1 change: 1 addition & 0 deletions test/test_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def test_hashfile(self):
with open(tempfile_path, 'w') as fh:
fh.write(data)
hashed_sha1 = hashfile(tempfile_path)
os.unlink(tempfile_path)
written_sha1 = self.repo.create_blob(data)
self.assertEqual(hashed_sha1, written_sha1)

Expand Down

0 comments on commit 1f3c017

Please sign in to comment.