From 17724e12220273e2824de5f068f57c0364117d30 Mon Sep 17 00:00:00 2001 From: florian <f.spreckelsen@inidscale.com> Date: Thu, 23 Feb 2023 15:42:43 +0100 Subject: [PATCH] TST: Add unittest for duplicate prefix option --- src/caoscrawler/crawl.py | 4 +++- unittests/test_tool.py | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/caoscrawler/crawl.py b/src/caoscrawler/crawl.py index 1b9b9e48..9a0e6ce5 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 eb4350bd..879bbe70 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) -- GitLab