Get the path of a temporary output image on disk. Temporary files are automatically cleaned up when the test tearDown occurs. Args: profile: The color profile. 'EXP' means explicit which means the 'mode' parameter is interpreted as a lit
(self, profile: str, mode: str)
| 184 | return script_dir / 'Data' / file_name |
| 185 | |
| 186 | def get_tmp_image_path(self, profile: str, mode: str) -> Path: |
| 187 | ''' |
| 188 | Get the path of a temporary output image on disk. |
| 189 | |
| 190 | Temporary files are automatically cleaned up when the test tearDown |
| 191 | occurs. |
| 192 | |
| 193 | Args: |
| 194 | profile: The color profile. 'EXP' means explicit which means |
| 195 | the 'mode' parameter is interpreted as a literal file |
| 196 | extension not a symbolic mode. |
| 197 | mode: The type of image to load. |
| 198 | |
| 199 | Return: |
| 200 | The path to the test image file on disk. |
| 201 | ''' |
| 202 | # Handle explicit mode |
| 203 | if profile == 'EXP': |
| 204 | file_handle, path = tempfile.mkstemp(mode, dir=self.tmp_dir.name) |
| 205 | os.close(file_handle) |
| 206 | os.remove(path) |
| 207 | return Path(path) |
| 208 | |
| 209 | # Handle symbolic modes |
| 210 | file_exts = { |
| 211 | 'LDR': { |
| 212 | 'comp': '.astc', |
| 213 | 'decomp': '.png', |
| 214 | 'bad': '.foo' |
| 215 | }, |
| 216 | 'LDRS': { |
| 217 | 'comp': '.astc', |
| 218 | 'decomp': '.png', |
| 219 | 'bad': '.foo' |
| 220 | }, |
| 221 | 'HDR': { |
| 222 | 'comp': '.astc', |
| 223 | 'decomp': '.exr', |
| 224 | 'bad': '.foo' |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | assert profile in file_exts |
| 229 | assert mode in file_exts['LDR'] |
| 230 | |
| 231 | suffix = file_exts[profile][mode] |
| 232 | file_handle, path = tempfile.mkstemp(suffix, dir=self.tmp_dir.name) |
| 233 | os.close(file_handle) |
| 234 | os.remove(path) |
| 235 | return Path(path) |
| 236 | |
| 237 | |
| 238 | class CLIPTest(CLITestBase): |
no outgoing calls
no test coverage detected