diff --git a/integrationtests/test_use_case_simple_presentation.py b/integrationtests/test_use_case_simple_presentation.py index 0f48677d4bf64158374a0eb0865eb2b85ea715db..642546619b0c9aa4eeae9ad33191b05b4b8ccb99 100644 --- a/integrationtests/test_use_case_simple_presentation.py +++ b/integrationtests/test_use_case_simple_presentation.py @@ -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),