| 78 | self.assertFalse(os.path.exists(self.workspace)) |
| 79 | |
| 80 | def create_workspace(self, tree: Dict[Any, Any]) -> None: |
| 81 | self.workspace = tempfile.mkdtemp() |
| 82 | if _keep_workspace(): |
| 83 | print("created workspace", self.workspace) |
| 84 | |
| 85 | # Copy testable tree |
| 86 | this_file_dir = os.path.dirname(os.path.abspath(__file__)) |
| 87 | for testable_cmake_file in TESTABLE_CMAKE_FILES: |
| 88 | source_path = os.path.join(this_file_dir, testable_cmake_file) |
| 89 | assert os.path.exists( |
| 90 | source_path |
| 91 | ), f"{testable_cmake_file} does not exist in {source_path}" |
| 92 | destination_path = os.path.join(self.workspace, testable_cmake_file) |
| 93 | os.makedirs(os.path.dirname(destination_path), exist_ok=True) |
| 94 | shutil.copy(source_path, destination_path) |
| 95 | |
| 96 | _create_file_tree(tree=tree, cwd=self.workspace) |
| 97 | |
| 98 | def assert_file_content(self, relativePath: str, expectedContent: str) -> None: |
| 99 | path = os.path.join(self.workspace, relativePath) |