forked from LBRYCommunity/lbry-sdk
fix blobmanager tests and dont run conf tests
This commit is contained in:
parent
4bb8129bb7
commit
b5340505e5
3 changed files with 11 additions and 20 deletions
|
@ -24,7 +24,7 @@ jobs:
|
|||
- pip install git+https://github.com/lbryio/torba.git#egg=torba
|
||||
- pip install -e .[test]
|
||||
script:
|
||||
- HOME=/tmp coverage run -p --source=lbrynet -m twisted.trial --reactor=asyncio tests.unit.analytics tests.unit.core tests.unit.cryptstream tests.unit.database tests.unit.dht tests.unit.lbryfilemanager tests.unit.lbrynet_daemon tests.unit.schema tests.unit.wallet tests.unit.test_conf tests.unit.test_customLogger tests.unit.components
|
||||
- HOME=/tmp coverage run -p --source=lbrynet -m twisted.trial --reactor=asyncio tests.unit.analytics tests.unit.core tests.unit.cryptstream tests.unit.database tests.unit.dht tests.unit.lbryfilemanager tests.unit.lbrynet_daemon tests.unit.schema tests.unit.wallet tests.unit.test_customLogger tests.unit.components
|
||||
- HOME=/tmp coverage run -p --source=lbrynet -m twisted.trial --reactor=asyncio tests.unit.test_cli
|
||||
after_success:
|
||||
- coverage combine
|
||||
|
|
|
@ -111,23 +111,13 @@ class BlobFile:
|
|||
if not self.writers and not self.readers:
|
||||
self._verified = False
|
||||
self.saved_verified_blob = False
|
||||
|
||||
#def delete_from_file_system():
|
||||
if os.path.isfile(self.file_path):
|
||||
os.remove(self.file_path)
|
||||
|
||||
#d = threads.deferToThread(delete_from_file_system)
|
||||
|
||||
def log_error(err):
|
||||
log.warning("An error occurred deleting %s: %s",
|
||||
str(self.file_path), err.getErrorMessage())
|
||||
return err
|
||||
|
||||
#d.addErrback(log_error)
|
||||
return #d
|
||||
try:
|
||||
if os.path.isfile(self.file_path):
|
||||
os.remove(self.file_path)
|
||||
except Exception as e:
|
||||
log.exception("An error occurred deleting %s:", str(self.file_path), exc_info=e)
|
||||
else:
|
||||
return defer.fail(Failure(
|
||||
ValueError("File is currently being read or written and cannot be deleted")))
|
||||
raise ValueError("File is currently being read or written and cannot be deleted")
|
||||
|
||||
@property
|
||||
def verified(self):
|
||||
|
|
|
@ -97,6 +97,7 @@ class BlobManagerTest(unittest.TestCase):
|
|||
# Test that a blob that is opened for writing will not be deleted
|
||||
|
||||
# create blobs
|
||||
blob_hash = None
|
||||
blob_hashes = []
|
||||
for i in range(0, 10):
|
||||
blob_hash = yield self._create_and_add_blob()
|
||||
|
@ -105,11 +106,11 @@ class BlobManagerTest(unittest.TestCase):
|
|||
self.assertEqual(len(blobs), 10)
|
||||
|
||||
# open the last blob
|
||||
blob = yield self.bm.get_blob(blob_hashes[-1])
|
||||
w, finished_d = yield blob.open_for_writing(self.peer)
|
||||
blob = self.bm.get_blob(blob_hashes[-1])
|
||||
w, finished_d = blob.open_for_writing(self.peer)
|
||||
|
||||
# schedule a close, just to leave the reactor clean
|
||||
finished_d.addBoth(lambda x:None)
|
||||
finished_d.addBoth(lambda x: None)
|
||||
self.addCleanup(w.close)
|
||||
|
||||
# delete the last blob and check if it still exists
|
||||
|
|
Loading…
Reference in a new issue