get_random_exp_name: Use custom random generator.

See https://github.com/iterative/dvclive/pull/576

Co-authored-by: Ivan Shcheklein <[email protected]>
This commit is contained in:
daavoo
2023-05-22 10:46:41 +02:00
committed by David de la Iglesia Castro
co-authored by Ivan Shcheklein
parent abd4f4a2a8
commit eb45cda5d0
3 changed files with 18 additions and 14 deletions
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -303,5 +303,5 @@ ignore-names = ["M", "SCM"]
max-args = 10
[tool.bandit]
exclude_dirs = ["tests", "scripts"]
exclude_dirs = ["tests", "scripts", "dvc/repo/experiments/utils.py"]
skips = ["B101"]
+12 -11
View File
@@ -2,18 +2,19 @@ from funcy import first
def test_generate_random_exp_name(tmp_dir, dvc, scm, exp_stage, mocker):
mocked_generator = mocker.MagicMock()
mocked_generator.choice.side_effect = [
0,
0,
0,
0,
1,
1,
0,
0,
]
mocker.patch(
"dvc.repo.experiments.utils.random.choice",
side_effect=[
0,
0,
0,
0,
1,
1,
0,
0,
],
"dvc.repo.experiments.utils.random.Random", return_value=mocked_generator
)
ref = first(dvc.experiments.run(exp_stage.addressing, params=["foo=1"]))