diff --git a/src/caoscrawler/crawl.py b/src/caoscrawler/crawl.py index 1b9b9e48d3f46d8638312a03e383105f14bcf87c..9a0e6ce560a4ccdc2caf80f4a5cc70736cde22f8 100644 --- a/src/caoscrawler/crawl.py +++ b/src/caoscrawler/crawl.py @@ -1286,7 +1286,9 @@ def crawler_main(crawled_directory_path: str, warnings.warn(DeprecationWarning("The prefix argument is deprecated and will be removed " "in the future. Please use `remove_prefix` instead.")) if remove_prefix is not None: - raise ValueError("Please do not supply prefix argument. Only remove_prefix") + raise ValueError("Please do not supply the (deprecated) `prefix` and the " + "`remove_prefix` argument at the same time. Only use " + "`remove_prefix` instead.") remove_prefix = prefix if dry_run: diff --git a/unittests/test_tool.py b/unittests/test_tool.py index eb4350bd1b5adc29941b12e9d0de99991e143321..879bbe70f68bf78bc5f47bc3b64a4a82b4ae6cf9 100755 --- a/unittests/test_tool.py +++ b/unittests/test_tool.py @@ -976,3 +976,9 @@ def test_deprecated_prefix_option(): with pytest.deprecated_call(): crawler_main("./", rfp("scifolder_cfood.yml"), prefix="to/be/removed") + + with raises(ValueError) as ve: + crawler_main("./", rfp("scifolder_cfood.yml"), prefix="to/be/removed", + remove_prefix="to/be/removed") + + assert "(deprecated) `prefix` and the `remove_prefix`" in str(ve.value)