* Use cache_dir instead of local_dir * Fix unit test * Use cache_dir and preserve local_dir parameter * Remove blank line at the end * Disable ut * Implement download_root suggestion * Use cache_dir=download_root
24 lines
610 B
Python
24 lines
610 B
Python
import os
|
|
|
|
from faster_whisper import download_model
|
|
|
|
|
|
def test_download_model(tmpdir):
|
|
output_dir = str(tmpdir.join("model"))
|
|
|
|
model_dir = download_model("tiny", output_dir=output_dir)
|
|
|
|
assert model_dir == output_dir
|
|
assert os.path.isdir(model_dir)
|
|
assert not os.path.islink(model_dir)
|
|
|
|
for filename in os.listdir(model_dir):
|
|
path = os.path.join(model_dir, filename)
|
|
assert not os.path.islink(path)
|
|
|
|
|
|
def test_download_model_in_cache(tmpdir):
|
|
cache_dir = str(tmpdir.join("model"))
|
|
download_model("tiny", cache_dir=cache_dir)
|
|
assert os.path.isdir(cache_dir)
|