Skip to content
Snippets Groups Projects
Commit 5612c3af authored by Tiago de Freitas Pereira's avatar Tiago de Freitas Pereira
Browse files

[nosetests] Minor fixes in the tests

parent 39ab48c0
No related branches found
No related tags found
1 merge request!81Sample Loaders able to handle certain type of annotations...
Pipeline #46348 passed
include README.rst bootstrap-buildout.py buildout.cfg develop.cfg LICENSE version.txt requirements.txt
recursive-include doc *.py *.rst
recursive-include bob/bio/face/test/data *.hdf5 *.jpg *.pos *.png *.json
recursive-include bob/bio/face/test/data *.hdf5 *.jpg *.pos *.png *.json *.tar.gz
......@@ -60,7 +60,9 @@ class MEDSDatabase(CSVDatasetDevEvalZTNorm):
csv_to_sample_loader=CSVToSampleLoader(
data_loader=bob.io.base.load,
metadata_loader=eyes_annotations_loader,
dataset_original_directory=rc["bob.db.meds.directory"],
dataset_original_directory=rc["bob.db.meds.directory"]
if rc["bob.db.meds.directory"]
else "",
extension=".jpg",
),
)
......
......@@ -40,7 +40,7 @@ def test_idiap_inceptionv2_msceleb_memory_demanding():
reference = bob.io.base.load(
pkg_resources.resource_filename(
"bob.bio.face.test", "data/inception_resnet_v2_rgb.hdf5"
"bob.bio.face.test", "data/inception_resnet_v2_msceleb_rgb.hdf5"
)
)
np.random.seed(10)
......
......@@ -4,36 +4,45 @@ import tempfile
import shutil
import os
def test_display_annotations():
from bob.bio.face.script.display_face_annotations import display_face_annotations
try:
tmp_dir = tempfile.mkdtemp(prefix="bobtest_")
annotations_dir = pkg_resources.resource_filename(
"bob.bio.face.test",
"data/annotations/"
"bob.bio.face.test", "data/annotations/"
)
runner = CliRunner()
result = runner.invoke(
display_face_annotations,
args=(
'--database', 'dummy',
'--groups', 'world', '--groups', 'dev',
'--annotations-dir', annotations_dir,
'--output-dir', tmp_dir, '--keep-all',
'--self-test',
)
"--database",
"dummy",
"--groups",
"train",
"--groups",
"dev",
"--annotations-dir",
annotations_dir,
"--output-dir",
tmp_dir,
"--keep-all",
"--self-test",
),
)
assertion_error_message = (
'Command exited with this output: `{}\' \n'
'If the output is empty, you can run this script locally to see '
'what is wrong:\n'
'$ bob bio display_face_annotations -vvv -d dummy -g world -g dev -a ./annotations/ -o /tmp/temp_annotated'
''.format(result.output))
"Command exited with this output: `{}' \n"
"If the output is empty, you can run this script locally to see "
"what is wrong:\n"
"$ bob bio display-face-annotations -vvv -d dummy -g train -g dev -a ./annotations/ -o /tmp/temp_annotated"
"".format(result.output)
)
assert result.exit_code == 0, assertion_error_message
# Checks if an annotated sample exists
sample_1_path = os.path.join(tmp_dir, "s1","1.png")
sample_1_path = os.path.join(tmp_dir, "s1", "1.png")
assertion_error_message = "File '{}' not created.".format(sample_1_path)
assert os.path.isfile(sample_1_path), assertion_error_message
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment