From 269e3f493ccb73dfcec9ef7c7f1b057f97b6eaca Mon Sep 17 00:00:00 2001
From: florian <f.spreckelsen@inidscale.com>
Date: Thu, 23 Feb 2023 15:22:05 +0100
Subject: [PATCH] TST: Add unittest for deprecation warning

---
 src/caoscrawler/crawl.py |  4 ++--
 unittests/test_tool.py   | 10 ++++++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/caoscrawler/crawl.py b/src/caoscrawler/crawl.py
index 89291610..9f9f8723 100644
--- a/src/caoscrawler/crawl.py
+++ b/src/caoscrawler/crawl.py
@@ -1283,8 +1283,8 @@ def crawler_main(crawled_directory_path: str,
         crawler.identifiableAdapter = ident
 
     if prefix != "":
-        warnings.warn(DeprecationWarning("The prefix argument is derpicated. Please use "
-                                         "remove_prefix."))
+        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")
         remove_prefix = prefix
diff --git a/unittests/test_tool.py b/unittests/test_tool.py
index 0cbfbdc5..eb4350bd 100755
--- a/unittests/test_tool.py
+++ b/unittests/test_tool.py
@@ -966,3 +966,13 @@ def test_split_restricted_path():
     assert ["el"] == split_restricted_path("/el")
     assert ["el"] == split_restricted_path("/el/")
     assert ["el", "el"] == split_restricted_path("/el/el")
+
+
+def test_deprecated_prefix_option():
+    """Test that calling the crawler's main function with the deprecated
+    `prefix` option correctly raises a Deprecation warning.
+
+    """
+
+    with pytest.deprecated_call():
+        crawler_main("./", rfp("scifolder_cfood.yml"), prefix="to/be/removed")
-- 
GitLab