Create a unique new temporary directory location. Create directories identified by sub_dir_path if provided in this temporary directory. Return the location for this unique directory joined with the `sub_dir_path` if any.
(self, sub_dir_path=None)
| 153 | return location |
| 154 | |
| 155 | def get_temp_dir(self, sub_dir_path=None): |
| 156 | """ |
| 157 | Create a unique new temporary directory location. Create directories |
| 158 | identified by sub_dir_path if provided in this temporary directory. |
| 159 | Return the location for this unique directory joined with the |
| 160 | `sub_dir_path` if any. |
| 161 | """ |
| 162 | # ensure that we have a new unique temp directory for each test run |
| 163 | global test_run_temp_dir |
| 164 | if not test_run_temp_dir: |
| 165 | import tempfile |
| 166 | |
| 167 | test_tmp_root_dir = tempfile.gettempdir() |
| 168 | # now we add a space in the path for testing path with spaces |
| 169 | test_run_temp_dir = fileutils.get_temp_dir( |
| 170 | base_dir=test_tmp_root_dir, prefix="scancode-tk-tests -" |
| 171 | ) |
| 172 | |
| 173 | test_run_temp_subdir = fileutils.get_temp_dir(base_dir=test_run_temp_dir, prefix="") |
| 174 | |
| 175 | if sub_dir_path: |
| 176 | # create a sub directory hierarchy if requested |
| 177 | sub_dir_path = to_os_native_path(sub_dir_path) |
| 178 | test_run_temp_subdir = path.join(test_run_temp_subdir, sub_dir_path) |
| 179 | fileutils.create_dir(test_run_temp_subdir) |
| 180 | return test_run_temp_subdir |
| 181 | |
| 182 | def remove_vcs(self, test_dir): |
| 183 | """ |
no test coverage detected