tests: use pytest caplog instead of custom mock

Close #1753
This commit is contained in:
Mr. Outis
2019-04-06 20:35:30 -06:00
parent 85cd344152
commit 921b39dbfe
19 changed files with 417 additions and 581 deletions
+10 -2
View File
@@ -6,17 +6,21 @@ import os
import shutil
import uuid
import tempfile
import logging
from git import Repo
from git.exc import GitCommandNotFound
from unittest import TestCase
import pytest
import dvc.logger as logger
from dvc.command.remote import CmdRemoteAdd
from dvc.repo import Repo as DvcRepo
from dvc.utils.compat import open, str
logger = logging.getLogger("dvc")
class TestDirFixture(object):
GCP_CREDS_FILE = os.path.abspath(
os.path.join("scripts", "ci", "gcp-creds.json")
@@ -139,7 +143,7 @@ class TestDvcFixture(TestGitFixture):
super(TestDvcFixture, self).setUp()
self.dvc = DvcRepo.init(self._root_dir)
self.dvc.scm.commit("init dvc")
logger.be_verbose()
logger.setLevel("DEBUG")
class TestDvcGitInitializedFixture(TestDvcFixture):
@@ -219,6 +223,10 @@ class TestDvc(TestDvcFixture, TestCase):
TestDvcFixture.__init__(self, root_dir)
TestCase.__init__(self, methodName)
@pytest.fixture(autouse=True)
def inject_fixtures(self, caplog):
self._caplog = caplog
class TestDvcPkg(TestDvcFixture, TestCase):
GIT_PKG = "git_pkg"