mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
[pre-commit.ci] pre-commit autoupdate (#8869)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/charliermarsh/ruff-pre-commit: v0.0.223 → v0.0.230](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.223...v0.0.230) * Update .pre-commit-config.yaml * fix lint issues Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: skshetry <[email protected]> Co-authored-by: Saugat Pachhai (सौगात) <[email protected]>
This commit is contained in:
co-authored by
skshetry
Saugat Pachhai
parent
b2c1c4dccd
commit
5165fb67a1
@@ -65,7 +65,7 @@ def test_check_ignore_non_matching(tmp_dir, dvc, non_matching, caplog, capsys):
|
||||
],
|
||||
)
|
||||
def test_check_ignore_error_args_cases(tmp_dir, dvc, args, caplog):
|
||||
assert main(["check-ignore"] + args) == 255
|
||||
assert main(["check-ignore", *args]) == 255
|
||||
assert "Having any troubles?" not in caplog.text
|
||||
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ def test_config_get(tmp_dir, dvc, capsys, caplog, args, ret, msg):
|
||||
)
|
||||
)
|
||||
|
||||
assert main(["config"] + args) == ret
|
||||
assert main(["config", *args]) == ret
|
||||
text = caplog.text if ret else capsys.readouterr()[0]
|
||||
assert msg in text
|
||||
|
||||
@@ -143,7 +143,7 @@ def test_config_get(tmp_dir, dvc, capsys, caplog, args, ret, msg):
|
||||
],
|
||||
)
|
||||
def test_config_get_in_non_dvc_repo(tmp_dir, caplog, args, ret):
|
||||
assert main(["config"] + args) == ret
|
||||
assert main(["config", *args]) == ret
|
||||
if ret != 0:
|
||||
out = caplog.text
|
||||
assert "Not inside a DVC repo" in out
|
||||
@@ -199,7 +199,7 @@ def test_config_list(tmp_dir, dvc, capsys):
|
||||
],
|
||||
)
|
||||
def test_config_list_in_non_dvc_repo(tmp_dir, caplog, args, ret):
|
||||
assert main(["config"] + args) == ret
|
||||
assert main(["config", *args]) == ret
|
||||
if ret != 0:
|
||||
out = caplog.text
|
||||
assert "Not inside a DVC repo" in out
|
||||
@@ -210,7 +210,7 @@ def test_config_list_in_non_dvc_repo(tmp_dir, caplog, args, ret):
|
||||
)
|
||||
def test_list_bad_args(tmp_dir, dvc, caplog, args):
|
||||
caplog.clear()
|
||||
assert main(["config", "--list"] + args) == 1
|
||||
assert main(["config", "--list", *args]) == 1
|
||||
assert (
|
||||
"-l/--list can't be used together with any of these options: "
|
||||
"-u/--unset, name, value"
|
||||
|
||||
@@ -39,7 +39,7 @@ def test_cloud_cli(tmp_dir, dvc, remote, mocker):
|
||||
# FIXME check status output
|
||||
oids_exist = mocker.spy(LocalHashFileDB, "oids_exist")
|
||||
|
||||
assert main(["push"] + args) == 0
|
||||
assert main(["push", *args]) == 0
|
||||
assert os.path.exists(cache)
|
||||
assert os.path.isfile(cache)
|
||||
assert os.path.isfile(cache_dir)
|
||||
@@ -52,7 +52,7 @@ def test_cloud_cli(tmp_dir, dvc, remote, mocker):
|
||||
dvc.odb.local.clear()
|
||||
oids_exist.reset_mock()
|
||||
|
||||
assert main(["fetch"] + args) == 0
|
||||
assert main(["fetch", *args]) == 0
|
||||
assert os.path.exists(cache)
|
||||
assert os.path.isfile(cache)
|
||||
assert os.path.isfile(cache_dir)
|
||||
@@ -64,7 +64,7 @@ def test_cloud_cli(tmp_dir, dvc, remote, mocker):
|
||||
|
||||
oids_exist.reset_mock()
|
||||
|
||||
assert main(["pull"] + args) == 0
|
||||
assert main(["pull", *args]) == 0
|
||||
assert os.path.exists(cache)
|
||||
assert os.path.isfile(cache)
|
||||
assert os.path.isfile(cache_dir)
|
||||
@@ -88,14 +88,14 @@ def test_cloud_cli(tmp_dir, dvc, remote, mocker):
|
||||
|
||||
_list_oids_traverse = mocker.spy(HashFileDB, "_list_oids_traverse")
|
||||
# NOTE: check if remote gc works correctly on directories
|
||||
assert main(["gc", "-cw", "-f"] + args) == 0
|
||||
assert main(["gc", "-cw", "-f", *args]) == 0
|
||||
assert _list_oids_traverse.called
|
||||
assert all(
|
||||
_kwargs["jobs"] == 2 for (_args, _kwargs) in oids_exist.call_args_list
|
||||
)
|
||||
shutil.move(dvc.odb.local.path, dvc.odb.local.path + ".back")
|
||||
|
||||
assert main(["fetch"] + args) == 0
|
||||
assert main(["fetch", *args]) == 0
|
||||
|
||||
assert oids_exist.called
|
||||
assert all(
|
||||
@@ -104,7 +104,7 @@ def test_cloud_cli(tmp_dir, dvc, remote, mocker):
|
||||
)
|
||||
|
||||
oids_exist.reset_mock()
|
||||
assert main(["pull", "-f"] + args) == 0
|
||||
assert main(["pull", "-f", *args]) == 0
|
||||
assert os.path.exists(cache)
|
||||
assert os.path.isfile(cache)
|
||||
assert os.path.isfile(cache_dir)
|
||||
|
||||
@@ -42,13 +42,11 @@ def create_dvc_pipeline(tmp_dir, dvc):
|
||||
tmp_dir.scm_gen({"script.py": script}, commit="init")
|
||||
tmp_dir.dvc_gen({"dep": "content"}, commit="init dvc")
|
||||
dvc.run(
|
||||
**{
|
||||
"cmd": "python script.py {}".format(os.path.join("out", "file")),
|
||||
"outs": [os.path.join("out", "file")],
|
||||
"deps": ["dep"],
|
||||
"fname": "out.dvc",
|
||||
"single_stage": True,
|
||||
}
|
||||
cmd="python script.py {}".format(os.path.join("out", "file")),
|
||||
outs=[os.path.join("out", "file")],
|
||||
deps=["dep"],
|
||||
fname="out.dvc",
|
||||
single_stage=True,
|
||||
)
|
||||
tmp_dir.scm_add(["out.dvc"], commit="run")
|
||||
shutil.rmtree("out")
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
extend = "../pyproject.toml"
|
||||
extend-select = ["RUF005"]
|
||||
extend-ignore = ["S", "RUF001", "ARG001", "ARG002"]
|
||||
|
||||
@@ -118,7 +118,7 @@ def test_list(tmp_dir, mocker, show_origin):
|
||||
from dvc.ui import ui
|
||||
|
||||
tmp_dir.gen(DATA)
|
||||
cli_args = parse_args(["machine", "list"] + show_origin + ["foo"])
|
||||
cli_args = parse_args(["machine", "list", *show_origin, "foo"])
|
||||
assert cli_args.func == CmdMachineList
|
||||
cmd = cli_args.func(cli_args)
|
||||
if show_origin:
|
||||
|
||||
@@ -629,7 +629,7 @@ def test_walk_nested_subrepos(tmp_dir, dvc, scm, traverse_subrepos):
|
||||
|
||||
extras = {".gitignore"} # these files are always there
|
||||
expected = {}
|
||||
for repo_dir in subrepos + [tmp_dir]:
|
||||
for repo_dir in [*subrepos, tmp_dir]:
|
||||
base = os.path.basename(repo_dir)
|
||||
scm_files = fs_structure(base)
|
||||
dvc_files = dvc_structure(base)
|
||||
|
||||
@@ -209,7 +209,7 @@ def test_order_deps_outs(dvc, typ):
|
||||
|
||||
stage = create_stage(PipelineStage, dvc, **kwargs, **extra)
|
||||
assert typ not in to_pipeline_file(stage)["something"]
|
||||
assert (
|
||||
list(to_pipeline_file(stage)["something"].keys())
|
||||
== ["cmd"] + all_types
|
||||
)
|
||||
assert list(to_pipeline_file(stage)["something"].keys()) == [
|
||||
"cmd",
|
||||
*all_types,
|
||||
]
|
||||
|
||||
@@ -20,7 +20,7 @@ def test_hook_is_called(tmp_dir, erepo_dir, mocker):
|
||||
for repo in subrepos:
|
||||
make_subrepo(repo, erepo_dir.scm)
|
||||
|
||||
for repo in subrepos + [erepo_dir]:
|
||||
for repo in [*subrepos, erepo_dir]:
|
||||
with repo.chdir():
|
||||
repo.scm_gen("foo", "foo", commit=f"git add {repo}/foo")
|
||||
repo.dvc_gen("bar", "bar", commit=f"dvc add {repo}/bar")
|
||||
|
||||
Reference in New Issue
Block a user