Skip to content
Snippets Groups Projects
Commit 01329a91 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

FIX: move test for remove_prefix to int tests

parent e12ede01
No related branches found
No related tags found
2 merge requests!105REL: v0.4.0,!101ENH: add the 'add_prefix' argument
Pipeline #34103 passed
...@@ -38,9 +38,7 @@ DATADIR = os.path.join(os.path.dirname(__file__), "test_data", ...@@ -38,9 +38,7 @@ DATADIR = os.path.join(os.path.dirname(__file__), "test_data",
"extroot", "use_case_simple_presentation") "extroot", "use_case_simple_presentation")
def test_complete_crawler( def test_complete_crawler(clear_database):
clear_database
):
# Setup the data model: # Setup the data model:
model = parser.parse_model_from_yaml(os.path.join(DATADIR, "model.yml")) model = parser.parse_model_from_yaml(os.path.join(DATADIR, "model.yml"))
model.sync_data_model(noquestion=True, verbose=False) model.sync_data_model(noquestion=True, verbose=False)
...@@ -57,6 +55,17 @@ def test_complete_crawler( ...@@ -57,6 +55,17 @@ def test_complete_crawler(
dryrun=False, dryrun=False,
forceAllowSymlinks=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, crawler_main(DATADIR,
os.path.join(DATADIR, "cfood.yml"), os.path.join(DATADIR, "cfood.yml"),
os.path.join(DATADIR, "identifiables.yml"), os.path.join(DATADIR, "identifiables.yml"),
......
...@@ -982,16 +982,3 @@ def test_deprecated_prefix_option(): ...@@ -982,16 +982,3 @@ def test_deprecated_prefix_option():
remove_prefix="to/be/removed") remove_prefix="to/be/removed")
assert "(deprecated) `prefix` and the `remove_prefix`" in str(ve.value) 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)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment