From 79f53cc9277514b211e784b9c7c0bd1a745719c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Wed, 20 Mar 2024 14:02:57 +0100 Subject: [PATCH] Add timeframe to warning about using find_first_match without ensure_strategy (#303) * Add timeframe to warning about using find_first_match without ensure_strategy * lint --- awesomeversion/awesomeversion.py | 3 ++- tests/test_awesomeversion.py | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/awesomeversion/awesomeversion.py b/awesomeversion/awesomeversion.py index 3583319..1e5e042 100644 --- a/awesomeversion/awesomeversion.py +++ b/awesomeversion/awesomeversion.py @@ -78,7 +78,8 @@ def __init__( if find_first_match and not ensure_strategy: warn( - "Can not use find_first_match without ensure_strategy", + "Can not use find_first_match without ensure_strategy, " + "this is ignored and will start raising an exception in 2025.", stacklevel=2, ) diff --git a/tests/test_awesomeversion.py b/tests/test_awesomeversion.py index a8cbfa3..9633274 100644 --- a/tests/test_awesomeversion.py +++ b/tests/test_awesomeversion.py @@ -237,8 +237,10 @@ def test_find_first_match_exception() -> None: """Test""" with warnings.catch_warnings(record=True) as warning_list: assert AwesomeVersion("1", find_first_match=True) - assert "Can not use find_first_match without ensure_strategy" in str( - warning_list[-1].message + assert ( + "Can not use find_first_match without ensure_strategy, " + "this is ignored and will start raising an exception in 2025." + in str(warning_list[-1].message) )