Skip to content
Snippets Groups Projects
Commit 4495790b authored by florian's avatar florian
Browse files

TST: Fix integration test

parent 04ade76d
No related branches found
No related tags found
2 merge requests!123REL: Release v0.6.0,!107ENH: setup logging and reporting for serverside execution
Pipeline #35052 canceled
......@@ -22,6 +22,7 @@
# ** end header
#
import logging
import os
import pytest
from subprocess import run
......@@ -38,7 +39,7 @@ DATADIR = os.path.join(os.path.dirname(__file__), "test_data",
"extroot", "use_case_simple_presentation")
def test_complete_crawler(clear_database):
def test_complete_crawler(clear_database, caplog):
# Setup the data model:
model = parser.parse_model_from_yaml(os.path.join(DATADIR, "model.yml"))
model.sync_data_model(noquestion=True, verbose=False)
......@@ -56,16 +57,17 @@ def test_complete_crawler(clear_database):
forceAllowSymlinks=False)
# test that a bad value for "remove_prefix" leads to runtime error
with pytest.raises(RuntimeError) as re:
crawler_main(
crawled_directory_path=os.path.join(DATADIR),
cfood_file_name=os.path.join(DATADIR, "cfood.yml"),
identifiables_definition_file=os.path.join(DATADIR, "identifiables.yml"),
provenance_file=os.path.join(DATADIR, "provenance.yml"),
dry_run=False,
remove_prefix="sldkfjsldf",
)
assert "path does not start with the prefix" in str(re.value)
caplog.set_level(logging.DEBUG, logger="caoscrawler.crawl")
assert 1 = crawler_main(
crawled_directory_path=os.path.join(DATADIR),
cfood_file_name=os.path.join(DATADIR, "cfood.yml"),
identifiables_definition_file=os.path.join(DATADIR, "identifiables.yml"),
provenance_file=os.path.join(DATADIR, "provenance.yml"),
dry_run=False,
remove_prefix="sldkfjsldf",
)
assert "path does not start with the prefix" in caplog.text
caplog.clear()
crawler_main(
crawled_directory_path=os.path.join(DATADIR),
......
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