diff options
| author | Barry Warsaw | 2012-07-20 22:12:04 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2012-07-20 22:12:04 -0400 |
| commit | b3579681d5b25226a9158c9f1c2912a4cb2288cb (patch) | |
| tree | 27fa85b8f96085e874b84f897df3ef9784918f07 /src/mailman/database/schema | |
| parent | 27672b5c94c78fecbda8cf91bb62618b7a0dc7cb (diff) | |
| download | mailman-b3579681d5b25226a9158c9f1c2912a4cb2288cb.tar.gz mailman-b3579681d5b25226a9158c9f1c2912a4cb2288cb.tar.zst mailman-b3579681d5b25226a9158c9f1c2912a4cb2288cb.zip | |
Get test suite completely working:
- migrations.rst needs to handle new standard migration
- Add ResetHelper() to refactor out common migration test cooperation.
- Handle temporary database.
- Fix some attribute names.
Diffstat (limited to 'src/mailman/database/schema')
| -rw-r--r-- | src/mailman/database/schema/mm_00000000000000_base.py | 21 | ||||
| -rw-r--r-- | src/mailman/database/schema/mm_20120407000000.py | 18 |
2 files changed, 25 insertions, 14 deletions
diff --git a/src/mailman/database/schema/mm_00000000000000_base.py b/src/mailman/database/schema/mm_00000000000000_base.py index d703088d6..ef448d620 100644 --- a/src/mailman/database/schema/mm_00000000000000_base.py +++ b/src/mailman/database/schema/mm_00000000000000_base.py @@ -21,14 +21,14 @@ from __future__ import absolute_import, print_function, unicode_literals __metaclass__ = type __all__ = [ - 'upgrade', 'post_reset', 'pre_reset', + 'upgrade', ] -_migration_path = None VERSION = '00000000000000' +_helper = None @@ -37,19 +37,12 @@ def upgrade(database, store, version, module_path): database.load_schema(store, version, filename, module_path) + def pre_reset(store): - global _migration_path - # Save the entry in the Version table for the test suite reset. This will - # be restored below. - from mailman.model.version import Version - result = store.find(Version, component=VERSION).one() - # Yes, we abuse this field. - _migration_path = result.version + global _helper + from mailman.testing.database import ResetHelper + _helper = ResetHelper(VERSION, store) def post_reset(store): - from mailman.model.version import Version - # We need to preserve the Version table entry for this migration, since - # its existence defines the fact that the tables have been loaded. - store.add(Version(component='schema', version=VERSION)) - store.add(Version(component=VERSION, version=_migration_path)) + _helper.restore(store) diff --git a/src/mailman/database/schema/mm_20120407000000.py b/src/mailman/database/schema/mm_20120407000000.py index 555d35ea2..ec4fcb2ee 100644 --- a/src/mailman/database/schema/mm_20120407000000.py +++ b/src/mailman/database/schema/mm_20120407000000.py @@ -21,6 +21,9 @@ from __future__ import absolute_import, print_function, unicode_literals __metaclass__ = type __all__ = [ + 'post_reset', + 'pre_reset', + 'upgrade', ] @@ -28,6 +31,10 @@ from mailman.interfaces.archiver import ArchivePolicy from mailman.interfaces.database import DatabaseError +VERSION = '20120407000000' +_helper = None + + def upgrade(database, store, version, module_path): if database.TAG == 'sqlite': @@ -68,3 +75,14 @@ def upgrade_sqlite(database, store, version, module_path): archive_policy, id)) store.execute('drop table mailinglist;') store.execute('alter table ml_backup rename to mailinglist;') + + + +def pre_reset(store): + global _helper + from mailman.testing.database import ResetHelper + _helper = ResetHelper(VERSION, store) + + +def post_reset(store): + _helper.restore(store) |
