summaryrefslogtreecommitdiff
path: root/gitdb/test/test_example.py
diff options
context:
space:
mode:
authorKostis Anagnostopoulos <ankostis@gmail.com>2016-10-24 17:32:06 +0200
committerKostis Anagnostopoulos <ankostis@gmail.com>2016-10-24 18:26:06 +0200
commit534c9bbe320f638153f9ffd79b79fa124b544d0f (patch)
tree731c56781e2b0bf367919ed8a0ef7e0a61f6a200 /gitdb/test/test_example.py
parent08b1f5f4fdc95d4ce24aa33ec82ac0d9723b8a02 (diff)
downloadgitdb-2.1.0.dev1.tar.gz
fix(win): FIX and HIDE 2 win-errors remainingv2.1.0.dev1
+ File-in-use errors were fixed with `gitdb.util.mman.collect()`! + This call is disabled `gitdb.util.HIDE_WINDOWS_KNOWN_ERRORS == False`. + Depend on latest smmp `v2.1.0.dev1` tag
Diffstat (limited to 'gitdb/test/test_example.py')
-rw-r--r--gitdb/test/test_example.py21
1 files changed, 7 insertions, 14 deletions
diff --git a/gitdb/test/test_example.py b/gitdb/test/test_example.py
index 6e80bf5..0bf6d1a 100644
--- a/gitdb/test/test_example.py
+++ b/gitdb/test/test_example.py
@@ -18,26 +18,19 @@ class TestExamples(TestBase):
for sha1 in ldb.sha_iter():
oinfo = ldb.info(sha1)
- ostream = ldb.stream(sha1)
- assert oinfo[:3] == ostream[:3]
+ with ldb.stream(sha1) as ostream:
+ assert oinfo[:3] == ostream[:3]
- assert len(ostream.read()) == ostream.size
+ assert len(ostream.read()) == ostream.size
assert ldb.has_object(oinfo.binsha)
# END for each sha in database
- # assure we close all files
- try:
- del(ostream)
- del(oinfo)
- except UnboundLocalError:
- pass
- # END ignore exception if there are no loose objects
data = "my data".encode("ascii")
istream = IStream("blob", len(data), BytesIO(data))
# the object does not yet have a sha
assert istream.binsha is None
- ldb.store(istream)
- # now the sha is set
- assert len(istream.binsha) == 20
- assert ldb.has_object(istream.binsha)
+ with ldb.store(istream):
+ # now the sha is set
+ assert len(istream.binsha) == 20
+ assert ldb.has_object(istream.binsha)