From ba76b8ffbff24ad3d68c92f62fa5964f0f1f4665 Mon Sep 17 00:00:00 2001 From: LuisFigueroaG Date: Wed, 7 Oct 2026 00:31:57 -0300 Subject: [PATCH] [Confluence] ConfluenceV2: don't warn about V1 methods on every init Creating a ConfluenceV2 client always emitted "V1 methods are deprecated in ConfluenceCloud. Use V2 methods instead.", even when only V2 methods are used, which is confusing since ConfluenceV2 is the recommended Cloud client. The V1 compatibility names already warn when they are called, so drop the unconditional warning from __init__. --- atlassian/confluence/cloud/cloud.py | 7 ++----- tests/test_confluence_v2_compatibility.py | 9 +++++++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/atlassian/confluence/cloud/cloud.py b/atlassian/confluence/cloud/cloud.py index 860f82806..19c7edfb9 100644 --- a/atlassian/confluence/cloud/cloud.py +++ b/atlassian/confluence/cloud/cloud.py @@ -63,11 +63,8 @@ def __init__(self, url: str, *args, **kwargs): # self._compatibility_method_mapping = { # "old_method_name": "new_method_name" # } - - # Warn about V1 method usage - warnings.warn( - "V1 methods are deprecated in ConfluenceCloud. Use V2 methods instead.", DeprecationWarning, stacklevel=2 - ) + # V1 method names emit their own DeprecationWarning when they are + # called, so creating the client itself does not warn. def __getattr__(self, name): """ diff --git a/tests/test_confluence_v2_compatibility.py b/tests/test_confluence_v2_compatibility.py index f087eb721..1e3a69a69 100644 --- a/tests/test_confluence_v2_compatibility.py +++ b/tests/test_confluence_v2_compatibility.py @@ -19,6 +19,15 @@ def setUp(self): password="password", ) + def test_init_does_not_warn(self): + """Creating a client must not emit a DeprecationWarning by itself.""" + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter("always") + + ConfluenceV2(url="https://example.atlassian.net/wiki", username="username", password="password") + + self.assertEqual([str(warning.message) for warning in w if warning.category is DeprecationWarning], []) + def test_method_mapping_exists(self): """Test that compatibility method mapping exists.""" self.assertTrue(hasattr(self.confluence_v2, "_compatibility_method_mapping"))