Skip to content

Commit dc1bfba

Browse files
committed
get_workspace_init_structure
1 parent 3d93e56 commit dc1bfba

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

util/tests/unittest_workspace.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,10 @@ def tearDown(self) -> None:
2525
if self.scratchspace_path.exists():
2626
shutil.rmtree(self.scratchspace_path)
2727

28-
def test_workspace_init(self) -> None:
29-
starting_structure = FilesystemStructure({})
30-
CleanTests.create_structure(self.scratchspace_path, starting_structure)
31-
32-
workspace = DBGymWorkspace(self.workspace_path)
33-
ending_symlinks_structure = FilesystemStructure({})
34-
ending_task_runs_structure = FilesystemStructure(
28+
@staticmethod
29+
def get_workspace_init_structure(workspace: DBGymWorkspace) -> FilesystemStructure:
30+
symlinks_structure = FilesystemStructure({})
31+
task_runs_structure = FilesystemStructure(
3532
{
3633
"latest_run.link": (
3734
"symlink",
@@ -40,10 +37,17 @@ def test_workspace_init(self) -> None:
4037
workspace.dbgym_this_run_path.name: {},
4138
}
4239
)
43-
ending_structure = CleanTests.make_workspace_structure(
44-
ending_symlinks_structure, ending_task_runs_structure
40+
return CleanTests.make_workspace_structure(
41+
symlinks_structure, task_runs_structure
4542
)
4643

44+
def test_init_from_nonexistent_workspace(self) -> None:
45+
starting_structure = FilesystemStructure({})
46+
CleanTests.create_structure(self.scratchspace_path, starting_structure)
47+
48+
workspace = DBGymWorkspace(self.workspace_path)
49+
ending_structure = WorkspaceTests.get_workspace_init_structure(workspace)
50+
4751
self.assertTrue(
4852
CleanTests.verify_structure(self.scratchspace_path, ending_structure)
4953
)

0 commit comments

Comments
 (0)