tests: unit: explicitly ask for dvc repo

Currently these rely on the root of the repo being in the dvc repo.
This commit is contained in:
Ruslan Kuprieiev
2023-06-19 03:44:10 +03:00
parent 7e1bb07f10
commit 1835c8c6e9
6 changed files with 24 additions and 24 deletions
+8 -8
View File
@@ -19,7 +19,7 @@ def test_digest(checksum, expected):
assert expected == _digest(checksum)
def test_default(mocker, capsys):
def test_default(mocker, capsys, dvc):
args = parse_args(["diff"])
cmd = args.func(args)
diff = {
@@ -51,7 +51,7 @@ def test_default(mocker, capsys):
).format(sep=os.path.sep) in capsys.readouterr()[0]
def test_show_hash(mocker, capsys):
def test_show_hash(mocker, capsys, dvc):
args = parse_args(["diff", "--show-hash"])
cmd = args.func(args)
diff = {
@@ -101,7 +101,7 @@ def test_show_hash(mocker, capsys):
) in out
def test_show_json(mocker, capsys):
def test_show_json(mocker, capsys, dvc):
args = parse_args(["diff", "--json"])
cmd = args.func(args)
diff = {
@@ -123,7 +123,7 @@ def test_show_json(mocker, capsys):
assert '"not in cache": []' in out
def test_show_json_and_hash(mocker, capsys):
def test_show_json_and_hash(mocker, capsys, dvc):
args = parse_args(["diff", "--json", "--show-hash"])
cmd = args.func(args)
@@ -160,7 +160,7 @@ def test_show_json_and_hash(mocker, capsys):
assert '"not in cache": []' in out
def test_show_json_hide_missing(mocker, capsys):
def test_show_json_hide_missing(mocker, capsys, dvc):
args = parse_args(["diff", "--json", "--hide-missing"])
cmd = args.func(args)
diff = {
@@ -190,7 +190,7 @@ def test_show_json_hide_missing(mocker, capsys):
@pytest.mark.parametrize("show_hash", [None, True, False])
def test_diff_show_markdown_and_hash(mocker, show_hash):
def test_diff_show_markdown_and_hash(mocker, show_hash, dvc):
options = ["diff", "--md"] + (["--show-hash"] if show_hash else [])
args = parse_args(options)
cmd = args.func(args)
@@ -221,7 +221,7 @@ def test_diff_show_markdown_and_hash(mocker, show_hash):
(["--md"], "| Status | Path |\n|----------|--------|"),
),
)
def test_no_changes(mocker, capsys, opts, show, expected):
def test_no_changes(mocker, capsys, opts, show, expected, dvc):
args = parse_args(["diff", *opts, *show])
cmd = args.func(args)
mocker.patch("dvc.repo.Repo.diff", return_value={})
@@ -330,7 +330,7 @@ def test_show_markdown_hide_missing(capsys):
).format(sep=os.path.sep)
def test_hide_missing(mocker, capsys):
def test_hide_missing(mocker, capsys, dvc):
args = parse_args(["diff", "--hide-missing"])
cmd = args.func(args)
diff = {