summaryrefslogtreecommitdiff
path: root/src/mailman/testing/layers.py
diff options
context:
space:
mode:
authorAurélien Bompard2014-10-06 19:17:50 +0200
committerAurélien Bompard2014-10-06 19:17:50 +0200
commitb023009538019927b5fe67f129469ee8d4951f91 (patch)
tree5827acf4b9a16de0914e8b9db4740f3092a3bbf8 /src/mailman/testing/layers.py
parent506b0fff2b4b1f068223d6e9cdfb254fd53bcdac (diff)
downloadmailman-b023009538019927b5fe67f129469ee8d4951f91.tar.gz
mailman-b023009538019927b5fe67f129469ee8d4951f91.tar.zst
mailman-b023009538019927b5fe67f129469ee8d4951f91.zip
Diffstat (limited to 'src/mailman/testing/layers.py')
-rw-r--r--src/mailman/testing/layers.py55
1 files changed, 0 insertions, 55 deletions
diff --git a/src/mailman/testing/layers.py b/src/mailman/testing/layers.py
index c1346b29f..99852e135 100644
--- a/src/mailman/testing/layers.py
+++ b/src/mailman/testing/layers.py
@@ -315,61 +315,6 @@ class RESTLayer(SMTPLayer):
-class DatabaseLayer:
- """Layer for database tests"""
-
- var_dir = None
-
- @classmethod
- def _drop_all_tables(cls):
- Model.metadata.drop_all(config.db.engine)
- md = MetaData()
- md.reflect(bind=config.db.engine)
- if "alembic_version" in md.tables:
- md.tables["alembic_version"].drop(config.db.engine)
-
- @classmethod
- def setUp(cls):
- # Set up the basic configuration stuff. Turn off path creation.
- config.create_paths = False
- if not event.subscribers:
- # only if not yet initialized by another layer
- initialize.initialize_1(INHIBIT_CONFIG_FILE)
- # Don't initialize the database.
- cls.var_dir = tempfile.mkdtemp()
- test_config = dedent("""
- [mailman]
- layout: testing
- [paths.testing]
- var_dir: {0}
- [devmode]
- testing: yes
- """.format(cls.var_dir))
- # Read the testing config and push it.
- test_config += resource_string('mailman.testing', 'testing.cfg')
- config.create_paths = True
- config.push('test config', test_config)
- # Write the configuration file for subprocesses and set up the config
- # object to pass that properly on the -C option.
- config_file = os.path.join(cls.var_dir, 'test.cfg')
- with open(config_file, 'w') as fp:
- fp.write(test_config)
- print(file=fp)
- config.filename = config_file
-
- @classmethod
- def tearDown(cls):
- assert cls.var_dir is not None, 'Layer not set up'
- shutil.rmtree(cls.var_dir)
- config.pop('test config')
- cls.var_dir = None
-
- @classmethod
- def testTearDown(cls):
- cls._drop_all_tables()
-
-
-
def is_testing():
"""Return a 'testing' flag for use with the predictable factories.