Commit e572f1c7 authored by Yannick DAYER's avatar Yannick DAYER

Test for bob db download-voxforge

parent d986238b
Pipeline #51747 failed with stage
in 7 minutes and 8 seconds
#!/usr/bin/env python
# Yannick Dayer <yannick.dayer@idiap.ch>
# Wed 16 Jun 2021 17:20:16 UTC+02
# @author: Yannick Dayer <yannick.dayer@idiap.ch>
# @date: Wed 16 Jun 2021 17:20:16 UTC+02
"""VoxForge CSV database interface default configuration
......
#!/usr/bin/env python
# Yannick Dayer <yannick.dayer@idiap.ch>
# Wed 16 Jun 2021 17:21:47 UTC+02
# @author: Yannick Dayer <yannick.dayer@idiap.ch>
# @date: Wed 16 Jun 2021 17:21:47 UTC+02
import logging
import os
......
#!/usr/bin/env python
# @author: Yannick Dayer <yannick.dayer@idiap.ch>
# Tue 22 Jun 2021 14:53:03 UTC+02
# @date: Tue 22 Jun 2021 14:53:03 UTC+02
import csv
import logging
......@@ -100,5 +100,5 @@ def download_voxforge(list_file, destination, force_download, verbose, **kwargs)
download_and_unzip(urls=[row["url"]], filename=full_filename)
logger.debug(f"Downloaded to {full_filename}")
logger.info(f"Download of {num_files} completed.")
logger.info(f"Download of {num_files} files completed.")
open_list_file.close()
#!/usr/bin/env python
# @author: Yannick Dayer <yannick.dayer@idiap.ch>
# @date: Tue 22 Jun 2021 14:53:03 UTC+02
from pathlib import Path
import pkg_resources
from click.testing import CliRunner
from bob.bio.spear.script.db_download import download_voxforge
from bob.extension.scripts.click_helper import assert_click_runner_result
def test_download_voxforge():
dataset_protocol = pkg_resources.resource_filename(
"bob.bio.spear.test", "data/dummy_dataset.tar.gz"
)
list_file = f"{dataset_protocol}:dummy/data_files_urls.csv"
runner = CliRunner()
with runner.isolated_filesystem():
result = runner.invoke(
download_voxforge,
args=[
"--list-file",
list_file,
"--destination",
"dummy_files",
],
)
assert_click_runner_result(result)
result_path = Path("dummy_files")
assert result_path.exists()
assert (result_path / "Dcoetzee-20110429-bne.tgz").exists()
assert (result_path / "Dcoetzee-20110429-bne").exists()
assert len(list(result_path.glob("*"))) == 20
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment