| 158 | os.makedirs(RUNTIME_VARS.TMP) |
| 159 | |
| 160 | def setUp(self): |
| 161 | # Setup the module |
| 162 | self.module_dir = tempfile.mkdtemp(dir=RUNTIME_VARS.TMP) |
| 163 | self.module_file = os.path.join(self.module_dir, f"{self.module_name}.py") |
| 164 | with salt.utils.files.fopen(self.module_file, "w") as fh: |
| 165 | fh.write(salt.utils.stringutils.to_str(loader_template_module)) |
| 166 | fh.flush() |
| 167 | os.fsync(fh.fileno()) |
| 168 | |
| 169 | self.utils_dir = tempfile.mkdtemp(dir=RUNTIME_VARS.TMP) |
| 170 | self.utils_file = os.path.join(self.utils_dir, f"{self.utils_name}.py") |
| 171 | with salt.utils.files.fopen(self.utils_file, "w") as fh: |
| 172 | fh.write(salt.utils.stringutils.to_str(loader_template_utils)) |
| 173 | fh.flush() |
| 174 | os.fsync(fh.fileno()) |
| 175 | |
| 176 | def tearDown(self): |
| 177 | shutil.rmtree(self.module_dir) |