Commit 6a60ffd4 authored by Amir MOHAMMADI's avatar Amir MOHAMMADI
Browse files

Merge branch 'use-default-atnt-directory' into 'master'

[test_utils] Do not re-download ATNT database

Closes #127

See merge request !218
parents e78575c4 254553e8
Pipeline #45985 passed with stages
in 14 minutes and 7 seconds
...@@ -8,8 +8,8 @@ import os ...@@ -8,8 +8,8 @@ import os
import sys import sys
import functools import functools
from nose.plugins.skip import SkipTest from nose.plugins.skip import SkipTest
from import download_and_unzip
import importlib import importlib
from bob.db.atnt.models import DEFAULT_DATADIR as ATNT_DEFAULT_DIR
# based on: # based on:
class Quiet(object): class Quiet(object):
...@@ -91,7 +91,7 @@ def db_available(dbname): ...@@ -91,7 +91,7 @@ def db_available(dbname):
atnt_default_directory = ( atnt_default_directory = (
if "ATNT_DATABASE_DIRECTORY" in os.environ if "ATNT_DATABASE_DIRECTORY" in os.environ
else "/idiap/group/biometric/databases/orl/" else ATNT_DEFAULT_DIR
) )
global atnt_downloaded_directory global atnt_downloaded_directory
atnt_downloaded_directory = None atnt_downloaded_directory = None
...@@ -102,36 +102,26 @@ def atnt_database_directory(): ...@@ -102,36 +102,26 @@ def atnt_database_directory():
if atnt_downloaded_directory: if atnt_downloaded_directory:
return atnt_downloaded_directory return atnt_downloaded_directory
if os.path.exists(atnt_default_directory): if os.path.isdir(atnt_default_directory):
return atnt_default_directory return atnt_default_directory
# TODO: THIS SHOULD BE A CLASS METHOD OF bob.db.atnt database from bob.db.atnt.driver import download
source_url = [ from argparse import Namespace
import tempfile import tempfile
atnt_downloaded_directory = tempfile.mkdtemp(prefix="atnt_db_") atnt_downloaded_directory = tempfile.mkdtemp(prefix="atnt_db_")
logger.warn( logger.warn(
"Downloading the AT&T database from '%s' to '%s' ...", "Downloading the AT&T database to '%s' ...",
atnt_downloaded_directory, atnt_downloaded_directory,
) )
logger.warn( logger.warn(
"To avoid this, please download the database manually, extract the data and set the ATNT_DATABASE_DIRECTORY environment variable to this directory." "To avoid this, please run atnt download."
) )
# to avoid re-downloading in parallel test execution # to avoid re-downloading in parallel test execution
os.environ["ATNT_DATABASE_DIRECTORY"] = atnt_downloaded_directory os.environ["ATNT_DATABASE_DIRECTORY"] = atnt_downloaded_directory
if not os.path.exists(atnt_downloaded_directory):
source_url, os.path.join(atnt_downloaded_directory, "")
return atnt_downloaded_directory return atnt_downloaded_directory
Supports Markdown
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