Skip to content

Commit

Permalink
Merge pull request #250 from jzyworonek/fix_deprication_warning
Browse files Browse the repository at this point in the history
Fix deprication warning being reported on import
  • Loading branch information
andrueastman authored Mar 26, 2024
2 parents 46e09b2 + 5be4b40 commit 3a890b7
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
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

0 comments on commit 3a890b7

Please sign in to comment.