diff --git a/dvc/config.py b/dvc/config.py index b72dff283..0cfbb8163 100644 --- a/dvc/config.py +++ b/dvc/config.py @@ -179,7 +179,7 @@ class Config(object): # pylint: disable=too-many-instance-attributes SECTION_CORE_STORAGEPATH = "storagepath" SECTION_CORE_SCHEMA = { - Optional(SECTION_CORE_LOGLEVEL, default="info"): And( + Optional(SECTION_CORE_LOGLEVEL): And( str, Use(str.lower), SECTION_CORE_LOGLEVEL_SCHEMA ), Optional(SECTION_CORE_REMOTE, default=""): And(str, Use(str.lower)), diff --git a/dvc/repo/__init__.py b/dvc/repo/__init__.py index 4f3f02947..659541bd1 100644 --- a/dvc/repo/__init__.py +++ b/dvc/repo/__init__.py @@ -68,11 +68,9 @@ class Repo(object): core = self.config.config[Config.SECTION_CORE] - logger.setLevel( - logging.getLevelName( - core.get(Config.SECTION_CORE_LOGLEVEL, "info").upper() - ) - ) + level = core.get(Config.SECTION_CORE_LOGLEVEL) + if level: + logger.setLevel(level.upper()) self.cache = Cache(self) self.cloud = DataCloud(self, config=self.config.config) diff --git a/tests/func/test_init.py b/tests/func/test_init.py index 1acdf06bb..f9889f7cd 100644 --- a/tests/func/test_init.py +++ b/tests/func/test_init.py @@ -64,3 +64,10 @@ class TestInitNoSCM(TestDir): self.assertEqual(ret, 0) self._test_init() + + +def test_init_quiet_should_not_display_welcome_screen(git, caplog): + ret = main(["init", "--quiet"]) + + assert 0 == ret + assert "" == caplog.text