Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprication warning being reported on import #250

Merged
merged 5 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.3.2] - 2024-03-25

### Added

### Changed

- Moved DeprecationWarning to __post_init__ of BaseRequestConfiguration. [microsoft/kiota#250](https://github.com/microsoft/kiota-abstractions-python/pull/250)


## [1.3.1] - 2024-03-05

### Added
Expand Down
2 changes: 1 addition & 1 deletion kiota_abstractions/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION: str = "1.3.1"
VERSION: str = "1.3.2"
10 changes: 6 additions & 4 deletions kiota_abstractions/base_request_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ 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
Loading