25 lines
607 B
Python
25 lines
607 B
Python
import os
|
|
import tempfile
|
|
|
|
import django
|
|
|
|
|
|
def main():
|
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.dev")
|
|
django.setup()
|
|
from apps.datasets.views.dataset import _make_mask_file
|
|
|
|
with tempfile.TemporaryDirectory() as tmp:
|
|
src = os.path.join(tmp, "1.mp4")
|
|
dst = os.path.join(tmp, "1_mask.mp4")
|
|
with open(src, "wb") as f:
|
|
f.write(b"not a real mp4")
|
|
_make_mask_file(src, dst)
|
|
assert os.path.exists(dst)
|
|
assert os.path.getsize(dst) == os.path.getsize(src)
|
|
print("ok")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|