Skip to content

Commit

Permalink
Fix deprication warning being reported on import
Browse files Browse the repository at this point in the history
  • Loading branch information
jzyworonek committed Mar 24, 2024
1 parent 46e09b2 commit edd8f8d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
9 changes: 5 additions & 4 deletions kiota_abstractions/base_request_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class RequestConfiguration(Generic[QueryParameters]):

@dataclass
class BaseRequestConfiguration(RequestConfiguration):
warn(
"BaseRequestConfiguration is deprecated. Use RequestConfiguration class instead.",
DeprecationWarning
)
def __post_init__(self):
warn(
"BaseRequestConfiguration is deprecated. Use RequestConfiguration class instead.",
DeprecationWarning
)
13 changes: 13 additions & 0 deletions tests/test_base_request_configuration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import pytest

from kiota_abstractions.base_request_configuration import BaseRequestConfiguration


def test_base_request_configuration_deprecation_warning():
with pytest.warns(DeprecationWarning, match="BaseRequestConfiguration is deprecated. Use RequestConfiguration class instead."):
BaseRequestConfiguration()


def test_import_base_request_configuration_no_warning():
from kiota_abstractions.base_request_configuration import BaseRequestConfiguration, RequestConfiguration
assert len(pytest.warns()) == 0

0 comments on commit edd8f8d

Please sign in to comment.