mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-01 23:08:43 +01:00
tests: use mocker instead of unittest.mock where possible
Had the "pleasure" of finding a mocker.patch leak into other tests and one of the suspicions is that mixing unittest.mock and mocker might be somehow related. In any case, we should use mocker where possible anyway.
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import os
|
||||
from unittest.mock import ANY
|
||||
|
||||
from dvc.repo.open_repo import CLONES
|
||||
from dvc.repo.open_repo import _external_repo as external_repo
|
||||
@@ -140,7 +139,9 @@ def test_shallow_clone_branch(erepo_dir, mocker):
|
||||
with repo.dvcfs.open("file") as fd:
|
||||
assert fd.read() == "branch"
|
||||
|
||||
clone_spy.assert_called_with(url, ANY, shallow_branch="branch", progress=ANY)
|
||||
clone_spy.assert_called_with(
|
||||
url, mocker.ANY, shallow_branch="branch", progress=mocker.ANY
|
||||
)
|
||||
|
||||
path, _ = CLONES[url]
|
||||
CLONES[url] = (path, True)
|
||||
@@ -165,7 +166,9 @@ def test_shallow_clone_tag(erepo_dir, mocker):
|
||||
with repo.dvcfs.open("file") as fd:
|
||||
assert fd.read() == "foo"
|
||||
|
||||
clone_spy.assert_called_with(url, ANY, shallow_branch="v1", progress=ANY)
|
||||
clone_spy.assert_called_with(
|
||||
url, mocker.ANY, shallow_branch="v1", progress=mocker.ANY
|
||||
)
|
||||
|
||||
path, _ = CLONES[url]
|
||||
CLONES[url] = (path, True)
|
||||
|
||||
Reference in New Issue
Block a user