test: abandon default DEBUG log level in tests

Now simple `py.test` command won't use DEBUG log level and `py.test ...
--log-level=LEVEL` will do what it's supposed to.

Staging continues to use DEBUG log level.

This is part of #1888 resolution.
This commit is contained in:
Alexander Schepanovski
2019-04-30 17:43:39 +07:00
parent 7d067f78b2
commit cdf318fff7
3 changed files with 12 additions and 5 deletions
+2 -2
View File
@@ -18,7 +18,7 @@ else:
params = " ".join(sys.argv[1:])
cmd = (
"py.test -v -n=4 --timeout=600 --timeout_method=thread --cov=dvc "
"{params} ".format(params=params)
"py.test -v -n=4 --timeout=600 --timeout_method=thread --log-level=debug"
" --cov=dvc {params} ".format(params=params)
)
check_call(cmd, shell=True)
-1
View File
@@ -163,7 +163,6 @@ class TestDvcFixture(TestGitFixture):
super(TestDvcFixture, self).setUp()
self.dvc = DvcRepo.init(self._root_dir)
self.dvc.scm.commit("init dvc")
logger.setLevel("DEBUG")
def tearDown(self):
self.dvc.scm.git.close()
+10 -2
View File
@@ -11,8 +11,16 @@ from .basic_env import TestDirFixture
@pytest.fixture(autouse=True)
def debug(caplog):
with caplog.at_level("DEBUG", logger="dvc"):
def reset_loglevel(request, caplog):
"""
Use it to ensure log level at the start of each test
regardless of dvc.logger.setup(), Repo configs or whatever.
"""
level = request.config.getoption("--log-level")
if level:
with caplog.at_level(level.upper(), logger="dvc"):
yield
else:
yield