mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-08 15:28:26 +01:00
tests: don't use var before assignment
```
repo_dir = <tests.basic_env.TestDirFixture object at 0x7f36c3f3d650>
git = <git.Repo "/tmp/dvc-test.2894.0LMoaT.eefefa48-172d-44e4-8c3d-4f65f76c78ee/.git">
@pytest.fixture
def dvc_repo(repo_dir, git):
try:
dvc = DvcRepo.init(repo_dir._root_dir)
dvc.scm.commit("init dvc")
yield dvc
finally:
> dvc.scm.git.close()
E UnboundLocalError: local variable 'dvc' referenced before assignment
/home/efiop/git/dvc/tests/conftest.py:76: UnboundLocalError
```
This commit is contained in:
+3
-1
@@ -68,12 +68,14 @@ def git(repo_dir):
|
||||
|
||||
@pytest.fixture
|
||||
def dvc_repo(repo_dir, git):
|
||||
dvc = None
|
||||
try:
|
||||
dvc = DvcRepo.init(repo_dir._root_dir)
|
||||
dvc.scm.commit("init dvc")
|
||||
yield dvc
|
||||
finally:
|
||||
dvc.scm.git.close()
|
||||
if dvc:
|
||||
dvc.scm.git.close()
|
||||
|
||||
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
Reference in New Issue
Block a user