try to close dvc.state on exit (#5962)

* try to close dvc.state on exit

I have a feeling that it is causing the issues with
shutil.copytree and some PermissionError during 'init',
as we are not closing it between multiple 'main()' calls.
But I am not quite sure, and this seems like a good thing to
do anyway.

* fixup

* close dvc on exit

* close cache on tests and on init
This commit is contained in:
Saugat Pachhai
2021-05-06 14:32:25 +03:00
committed by GitHub
parent eabf6ddf27
commit 77be01ee2d
11 changed files with 98 additions and 52 deletions
+5 -1
View File
@@ -154,6 +154,10 @@ class TestDvcFixture(TestDirFixture):
super().setUp()
self.dvc = DvcRepo.init(self.root_dir, no_scm=True)
def tearDown(self):
self.dvc.close()
super().tearDown()
class TestDvcGitFixture(TestGitFixture):
def setUp(self):
@@ -162,7 +166,7 @@ class TestDvcGitFixture(TestGitFixture):
self.dvc.scm.commit("init dvc")
def tearDown(self):
self.dvc.scm.close()
self.dvc.close()
super().tearDown()