[PATCH] tests: hide database setup queries with pytest
Thomas De Schampheleire
patrickdepinguin at gmail.com
Sat Jul 11 15:06:59 EDT 2015
# HG changeset patch
# User Thomas De Schampheleire <thomas.de.schampheleire at gmail.com>
# Date 1435831639 -7200
# Thu Jul 02 12:07:19 2015 +0200
# Node ID a71b7c1c0efa80456ed9e85dcbba9990eaec154f
# Parent 53d68f201e4602d3f2ccfcd27107d2ebea2deea2
tests: hide database setup queries with pytest
Unlike nosetest, pytest would show the database setup queries at the
beginning of the test run, which don't bring added value.
Hide them by disabling logging during this time.
Note that this does not provide an easy method of enabling the logging on
demand (what could be done with the -s switch in nosetest).
diff --git a/kallithea/tests/conftest.py b/kallithea/tests/conftest.py
--- a/kallithea/tests/conftest.py
+++ b/kallithea/tests/conftest.py
@@ -5,9 +5,12 @@ import pkg_resources
from paste.deploy import loadapp
import pylons.test
from pylons.i18n.translation import _get_translator
-
+import logging
def pytest_configure():
+
+ logging.disable(logging.CRITICAL)
+
path = os.getcwd()
sys.path.insert(0, path)
pkg_resources.working_set.add_entry(path)
@@ -26,4 +29,6 @@ def pytest_configure():
translator = _get_translator(pylons.config.get('lang'))
pylons.translator._push_object(translator)
+ logging.disable(logging.NOTSET)
+
return pylons.test.pylonsapp
More information about the kallithea-general
mailing list