diff --git a/integrationtests/test_use_case_simple_presentation.py b/integrationtests/test_use_case_simple_presentation.py index 4b006bd6d6e9b2d707b979f666edbba0967fc7a3..5fc0f6c7d85a0fce4490c72952e711fe241a0099 100644 --- a/integrationtests/test_use_case_simple_presentation.py +++ b/integrationtests/test_use_case_simple_presentation.py @@ -38,9 +38,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): # Setup the data model: model = parser.parse_model_from_yaml(os.path.join(DATADIR, "model.yml")) model.sync_data_model(noquestion=True, verbose=False) @@ -57,6 +55,17 @@ def test_complete_crawler( dryrun=False, forceAllowSymlinks=False) + # test that a bad value for "remove_prefix" leads to runtime error + with pytest.raises(RuntimeError) as re: + crawler_main(DATADIR, + os.path.join(DATADIR, "cfood.yml"), + os.path.join(DATADIR, "identifiables.yml"), + True, + os.path.join(DATADIR, "provenance.yml"), + False, + remove_prefix="sldkfjsldf") + assert "path does not start with the prefix" in str(re.value) + crawler_main(DATADIR, os.path.join(DATADIR, "cfood.yml"), os.path.join(DATADIR, "identifiables.yml"), diff --git a/unittests/test_tool.py b/unittests/test_tool.py index e8bf23cf436436d29e00f09a53768b762bc538bd..af84f8fdbeb7f792a2648b6baab3c0266f803474 100755 --- a/unittests/test_tool.py +++ b/unittests/test_tool.py @@ -982,16 +982,3 @@ def test_deprecated_prefix_option(): remove_prefix="to/be/removed") assert "(deprecated) `prefix` and the `remove_prefix`" in str(ve.value) - - -def test_wrong_remove_prefix_option(): - """Test that calling the crawler's main function with `remove_prefix` option - with a bad value raises the correct error. - """ - - with raises(RuntimeError) as re: - crawler_main(rfp("test_directories", "examples_article"), - rfp("scifolder_extended.yml"), - remove_prefix="to/be/removed") - - assert "path does not start with the prefix" in str(re.value)