Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7163673
D238.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D238.diff
View Options
diff --git a/swh/storage/tests/storage_testing.py b/swh/storage/tests/storage_testing.py
--- a/swh/storage/tests/storage_testing.py
+++ b/swh/storage/tests/storage_testing.py
@@ -57,21 +57,16 @@
self.objtmp.cleanup()
super().tearDown()
- def reset_tables(self):
+ def reset_storage_tables(self):
+ excluded = {'dbversion', 'entity', 'entity_history', 'listable_entity',
+ 'fossology_license', 'indexer_configuration'}
+ self.reset_db_tables(self.TEST_STORAGE_DB_NAME, excluded=excluded)
+
db = self.test_db[self.TEST_STORAGE_DB_NAME]
conn = db.conn
cursor = db.cursor
- cursor.execute("""SELECT table_name FROM information_schema.tables
- WHERE table_schema = %s""", ('public',))
-
- tables = set(table for (table,) in cursor.fetchall())
- tables -= {'dbversion', 'entity', 'entity_history', 'listable_entity',
- 'fossology_license', 'indexer_configuration'}
-
- for table in tables:
- cursor.execute('truncate table %s cascade' % table)
-
cursor.execute('delete from entity where generated=true')
cursor.execute('delete from entity_history where generated=true')
+
conn.commit()
diff --git a/swh/storage/tests/test_storage.py b/swh/storage/tests/test_storage.py
--- a/swh/storage/tests/test_storage.py
+++ b/swh/storage/tests/test_storage.py
@@ -545,7 +545,7 @@
}
def tearDown(self):
- self.reset_tables()
+ self.reset_storage_tables()
super().tearDown()
def fetch_tools(self):
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jan 30, 12:41 PM (9 h, 52 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3221208
Attached To
D238: storage_testing: leverage reset_db_tables from db_testing
Event Timeline
Log In to Comment