Skip to content

Commit 608147e

Browse files
committed
Better explain conditional cleanup in test_base_object
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).
1 parent 018ebaf commit 608147e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

test/test_base.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ def test_base_object(self):
7272
self.assertEqual(item, item.stream_data(tmpfile))
7373
tmpfile.seek(0)
7474
self.assertEqual(tmpfile.read(), data)
75-
os.remove(tmpfile.name) # Do it this way so we can inspect the file on failure.
75+
76+
# Remove the file this way, instead of with a context manager or "finally",
77+
# so it is only removed on success, and we can inspect the file on failure.
78+
os.remove(tmpfile.name)
7679
# END for each object type to create
7780

7881
# Each has a unique sha.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy