-
Couldn't load subscription status.
- Fork 1.2k
Closed
Labels
p3-nice-to-haveIt should be done this or next sprintIt should be done this or next sprintrefactoringFactoring and re-factoringFactoring and re-factoringtestingRelated to the tests and the testing infrastructureRelated to the tests and the testing infrastructure
Description
To simply create a dvc or git controlled foo you need to:
def test_someting(erepo_dir, monkeypatch):
# for dvc
with monkeypatch.context() as m:
m.chdir(erepo_dir)
erepo_dir.dvc_gen("foo", "foo")
# for git
with monkeypatch.context() as m:
m.chdir(erepo_dir)
erepo_dir.scm_gen("foo", "foo", commit="add foo")Which is far more bloaty then for tmp_dir. See here how @pared is struggling with it)
I see two options:
-
Make it work without chdir:
erepo_dir.dvc_gen("foo", "foo")
This will, however, bring an assymetry:
# creates erepo_dir / foo erepo_dir.gen("foo", "foo") # dvc adds erepo_dir / foo erepo_dir.dvc_add("foo") # dvc adds <curdir> / foo erepo_dir.dvc.add("foo")
We don't really want to wrap
scmanddvcobjects. -
Use chdir but make it simpler:
def test_someting(erepo_dir): with erepo_dir.chdir(): erepo_dir.dvc_gen("foo", "foo")
Saved one line, no need to add
monkeypatchto args, still have nesting and an extra line compared to option 1. Retain symmetry, may usescmanddvcwith relpaths in the context.
efiop
Metadata
Metadata
Assignees
Labels
p3-nice-to-haveIt should be done this or next sprintIt should be done this or next sprintrefactoringFactoring and re-factoringFactoring and re-factoringtestingRelated to the tests and the testing infrastructureRelated to the tests and the testing infrastructure