Checking that tests are happening in tmp directory.

This commit is contained in:
Roland 2024-02-05 14:52:38 -07:00
parent 1c71dc7092
commit 8b67dc87ff
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
2 changed files with 3 additions and 1 deletions

View file

@ -434,7 +434,7 @@ def find_outdated_zim_files(path: pathlib.Path = None) -> Tuple[List[pathlib.Pat
return list(), list()
# Find all non-empty Zim files.
files = [i for i in walk(path) if i.is_file() and i.stat().st_size and i.suffix == '.zim']
files = [i for i in walk(path) if i.is_file() and i.suffix == '.zim' and i.stat().st_size]
zims = list()
for file in files:
try:

View file

@ -566,6 +566,8 @@ def get_media_directory() -> Path:
raise ValueError('No test media directory set during testing!!')
if isinstance(TEST_MEDIA_DIRECTORY, pathlib.Path):
if not str(TEST_MEDIA_DIRECTORY).startswith('/tmp'):
raise RuntimeError('Refusing to run test outside tmp directory!')
return TEST_MEDIA_DIRECTORY
return MEDIA_DIRECTORY