Skip to content
Snippets Groups Projects
Commit 269e3f49 authored by florian's avatar florian
Browse files

TST: Add unittest for deprecation warning

parent 72f0dde3
No related branches found
No related tags found
2 merge requests!105REL: v0.4.0,!101ENH: add the 'add_prefix' argument
Pipeline #33959 passed
...@@ -1283,8 +1283,8 @@ def crawler_main(crawled_directory_path: str, ...@@ -1283,8 +1283,8 @@ def crawler_main(crawled_directory_path: str,
crawler.identifiableAdapter = ident crawler.identifiableAdapter = ident
if prefix != "": if prefix != "":
warnings.warn(DeprecationWarning("The prefix argument is derpicated. Please use " warnings.warn(DeprecationWarning("The prefix argument is deprecated and will be removed "
"remove_prefix.")) "in the future. Please use `remove_prefix` instead."))
if remove_prefix is not None: if remove_prefix is not None:
raise ValueError("Please do not supply prefix argument. Only remove_prefix") raise ValueError("Please do not supply prefix argument. Only remove_prefix")
remove_prefix = prefix remove_prefix = prefix
......
...@@ -966,3 +966,13 @@ def test_split_restricted_path(): ...@@ -966,3 +966,13 @@ def test_split_restricted_path():
assert ["el"] == split_restricted_path("/el") assert ["el"] == split_restricted_path("/el")
assert ["el"] == split_restricted_path("/el/") assert ["el"] == split_restricted_path("/el/")
assert ["el", "el"] == split_restricted_path("/el/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")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment