mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-10 15:28:34 +01:00
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:
+2
-2
@@ -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)
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user