Skip to content

Commit

Permalink
Better explain conditional cleanup in test_base_object
Browse files Browse the repository at this point in the history
This expands the comment added in 41fac85 (gitpython-developers#1770) to make more
clear that this particular cleanup is deliberately done only when
the operation was successful (and why).
  • Loading branch information
EliahKagan committed Feb 29, 2024
1 parent 018ebaf commit 608147e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ def test_base_object(self):
self.assertEqual(item, item.stream_data(tmpfile))
tmpfile.seek(0)
self.assertEqual(tmpfile.read(), data)
os.remove(tmpfile.name) # Do it this way so we can inspect the file on failure.

# Remove the file this way, instead of with a context manager or "finally",
# so it is only removed on success, and we can inspect the file on failure.
os.remove(tmpfile.name)
# END for each object type to create

# Each has a unique sha.
Expand Down

0 comments on commit 608147e

Please sign in to comment.