@@ -25,13 +25,10 @@ def tearDown(self) -> None:
25
25
if self .scratchspace_path .exists ():
26
26
shutil .rmtree (self .scratchspace_path )
27
27
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 (
35
32
{
36
33
"latest_run.link" : (
37
34
"symlink" ,
@@ -40,10 +37,17 @@ def test_workspace_init(self) -> None:
40
37
workspace .dbgym_this_run_path .name : {},
41
38
}
42
39
)
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
45
42
)
46
43
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
+
47
51
self .assertTrue (
48
52
CleanTests .verify_structure (self .scratchspace_path , ending_structure )
49
53
)
0 commit comments