From 15ce0a7670e3c7caaa73cb757fdcbc40148f1d09 Mon Sep 17 00:00:00 2001 From: Matt Dietz Date: Fri, 5 Sep 2014 22:06:17 +0000 Subject: [PATCH] Quieter unit tests I couldn't find any options while perusing the alembic documentation that specifically controlled logging, plus control of everything seems to fall under the env.py umbrella, so I decided I would leave logging unconfigured unless it was otherwise necessary. There are still a handful of warnings that appear in the test run that can be cleaned up later, but at least the entire run fits on one screen again. --- quark/db/migration/alembic/env.py | 3 ++- quark/tests/test_migrations.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/quark/db/migration/alembic/env.py b/quark/db/migration/alembic/env.py index 6b8f247..f05662b 100644 --- a/quark/db/migration/alembic/env.py +++ b/quark/db/migration/alembic/env.py @@ -12,7 +12,8 @@ neutron_config = config.neutron_config # Interpret the config file for Python logging. # This line sets up loggers basically. -logging_config.fileConfig(config.config_file_name) +if not config.get_main_option("quiet_mode"): + logging_config.fileConfig(config.config_file_name) # other values from the config, defined by the needs of env.py, # can be acquired: diff --git a/quark/tests/test_migrations.py b/quark/tests/test_migrations.py index 0a34e7c..031e851 100644 --- a/quark/tests/test_migrations.py +++ b/quark/tests/test_migrations.py @@ -27,6 +27,7 @@ class BaseMigrationTest(test_base.TestBase): os.path.join(quark.db.migration.__path__[0], 'alembic.ini')) self.config.set_main_option('script_location', 'quark.db.migration:alembic') + self.config.set_main_option("quiet_mode", "True") self.fileno, self.filepath = tempfile.mkstemp() secret_cfg = mock.MagicMock() secret_cfg.database.connection = "sqlite:///" + self.filepath