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:
Ruslan Kuprieiev
2023-06-18 17:10:45 +03:00
parent b8c666b1b7
commit c827654fe7
9 changed files with 83 additions and 78 deletions
+2 -3
View File
@@ -4,7 +4,6 @@ import os
import shutil
import stat
import textwrap
from unittest.mock import call
import pytest
@@ -631,8 +630,8 @@ def test_add_optimization_for_hardlink_on_empty_files(tmp_dir, dvc, mocker):
stages = dvc.add(["foo", "bar", "lorem", "ipsum"])
assert m.call_count == 8
assert m.call_args != call(tmp_dir / "foo")
assert m.call_args != call(tmp_dir / "bar")
assert m.call_args != mocker.call(tmp_dir / "foo")
assert m.call_args != mocker.call(tmp_dir / "bar")
for stage in stages[:2]:
# hardlinks are not created for empty files