File, directory, or any path exists
(self, path, msg='', func=os.stat)
| 177 | # file asserts |
| 178 | # |
| 179 | def assertExists(self, path, msg='', func=os.stat): |
| 180 | """File, directory, or any path exists""" |
| 181 | if isinstance(path, Path): |
| 182 | path = str(path) |
| 183 | assert isinstance( |
| 184 | path, str), f'path must be a string, not {type(path)}' |
| 185 | path = os.path.expandvars(path) |
| 186 | if not self.check_exists(func, getTestPath(path)): |
| 187 | raise AssertionError( |
| 188 | 'The file %s should exist, but it does not. %s' % (path, msg)) |
| 189 | |
| 190 | def assertNotExists(self, path, msg='', func=os.stat): |
| 191 | if self.check_exists(func, getTestPath(path)): |