mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge branch 'release_15.07' into dev
Conflicts: lib/galaxy/model/__init__.py
This commit is contained in:
@@ -1619,13 +1619,11 @@ class Dataset( object ):
|
||||
def get_total_size( self ):
|
||||
if self.total_size is not None:
|
||||
return self.total_size
|
||||
if self.file_size:
|
||||
# for backwards compatibility, set if unset
|
||||
self.set_total_size()
|
||||
db_session = object_session( self )
|
||||
db_session.flush()
|
||||
return self.total_size
|
||||
return 0
|
||||
# for backwards compatibility, set if unset
|
||||
self.set_total_size()
|
||||
db_session = object_session( self )
|
||||
db_session.flush()
|
||||
return self.total_size
|
||||
|
||||
def set_total_size( self ):
|
||||
if self.file_size is None:
|
||||
|
||||
@@ -483,7 +483,7 @@ def _purge_dataset( app, dataset, remove_from_disk, info_only=False ):
|
||||
if hda.history.user is not None and hda.history.user not in usage_users:
|
||||
usage_users.append( hda.history.user )
|
||||
for user in usage_users:
|
||||
user.total_disk_usage -= dataset.total_size
|
||||
user.total_disk_usage -= dataset.get_total_size()
|
||||
app.sa_session.add( user )
|
||||
print "Purging dataset id", dataset.id
|
||||
dataset.purged = True
|
||||
|
||||
@@ -410,7 +410,7 @@ class MappingTests( unittest.TestCase ):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
# Start the database and connect the mapping
|
||||
cls.model = mapping.init( "/tmp", "sqlite:///:memory:", create_tables=True )
|
||||
cls.model = mapping.init( "/tmp", "sqlite:///:memory:", create_tables=True, object_store=MockObjectStore() )
|
||||
assert cls.model.engine is not None
|
||||
|
||||
@classmethod
|
||||
@@ -439,6 +439,21 @@ class MappingTests( unittest.TestCase ):
|
||||
cls.model.session.expunge_all()
|
||||
|
||||
|
||||
class MockObjectStore(object):
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def size(self, dataset):
|
||||
return 42
|
||||
|
||||
def exists(self, *args, **kwds):
|
||||
return True
|
||||
|
||||
def get_filename(self, *args, **kwds):
|
||||
return "dataest_14.dat"
|
||||
|
||||
|
||||
def get_suite():
|
||||
suite = unittest.TestSuite()
|
||||
suite.addTest( MappingTests( "test_basic" ) )
|
||||
|
||||
Reference in New Issue
Block a user