Skip to content

Commit 3d93e56

Browse files
committed
test_workspace_init
1 parent d4c3206 commit 3d93e56

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

manage/tests/unittest_clean.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ def make_workspace_structure(
130130
"dbgym_workspace": {
131131
"symlinks": symlinks_structure,
132132
"task_runs": task_runs_structure,
133+
"tmp": {},
133134
}
134135
}
135136
)

util/tests/unittest_workspace.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
import unittest
55
from pathlib import Path
66

7-
from manage.tests.unittest_clean import FilesystemStructure
7+
from manage.tests.unittest_clean import CleanTests, FilesystemStructure
8+
from util.workspace import DBGymWorkspace
89

910

1011
class WorkspaceTests(unittest.TestCase):
@@ -25,4 +26,24 @@ def tearDown(self) -> None:
2526
shutil.rmtree(self.scratchspace_path)
2627

2728
def test_workspace_init(self) -> None:
28-
pass
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(
35+
{
36+
"latest_run.link": (
37+
"symlink",
38+
f"dbgym_workspace/task_runs/{workspace.dbgym_this_run_path.name}",
39+
),
40+
workspace.dbgym_this_run_path.name: {},
41+
}
42+
)
43+
ending_structure = CleanTests.make_workspace_structure(
44+
ending_symlinks_structure, ending_task_runs_structure
45+
)
46+
47+
self.assertTrue(
48+
CleanTests.verify_structure(self.scratchspace_path, ending_structure)
49+
)

0 commit comments

Comments
 (0)