Skip to content

Commit a68cfa4

Browse files
authored
bump version to 1.4.0 and update changelog (#153)
* bump version to 1.4.0 and update changelog * rework attribute deprecation/removal tests to check both pre and post removal * remove deprecated StreamDecryptor.body_start and StreamDecryptor.body_end for 1.4.0 release * clarify changelog entry
1 parent 5efa515 commit a68cfa4

File tree

5 files changed

+44
-22
lines changed

5 files changed

+44
-22
lines changed

CHANGELOG.rst

+14-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Changelog
33
*********
44

5-
1.x.x -- 201x-xx-xx
5+
1.4.0 -- 2019-05-23
66
===================
77

88
Minor
@@ -11,6 +11,19 @@ Minor
1111
* Remove dependence on all ``source_stream`` APIs except for ``read()``.
1212
`#103 <https://github.com/aws/aws-encryption-sdk-python/issues/103>`_
1313

14+
Potentially Backwards Incompatible
15+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16+
17+
* Encryption streams no longer close the ``source_stream`` when they themselves close.
18+
If you are using context managers for all of your stream handling,
19+
this change will not affect you.
20+
However, if you have been relying on the ``StreamDecryptor``
21+
or ``StreamEncryptor`` to close your ``source_stream`` for you,
22+
you will now need to close those streams yourself.
23+
* ``StreamDecryptor.body_start`` and ``StreamDecryptor.body_end``,
24+
deprecated in a prior release,
25+
have now been removed.
26+
1427
Maintenance
1528
-----------
1629

src/aws_encryption_sdk/identifiers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
# We only actually need these imports when running the mypy checks
2828
pass
2929

30-
__version__ = "1.3.8"
30+
__version__ = "1.4.0"
3131
USER_AGENT_SUFFIX = "AwsEncryptionSdkPython/{}".format(__version__)
3232

3333

src/aws_encryption_sdk/streaming_client.py

-12
Original file line numberDiff line numberDiff line change
@@ -781,18 +781,6 @@ def _read_header(self):
781781
validate_header(header=header, header_auth=header_auth, raw_header=raw_header, data_key=self._derived_data_key)
782782
return header, header_auth
783783

784-
@property
785-
def body_start(self):
786-
"""Log deprecation warning when body_start is accessed."""
787-
_LOGGER.warning("StreamDecryptor.body_start is deprecated and will be removed in 1.4.0")
788-
return self._body_start
789-
790-
@property
791-
def body_end(self):
792-
"""Log deprecation warning when body_end is accessed."""
793-
_LOGGER.warning("StreamDecryptor.body_end is deprecated and will be removed in 1.4.0")
794-
return self._body_end
795-
796784
def _prep_non_framed(self):
797785
"""Prepare the opening data for a non-framed message."""
798786
self._unframed_body_iv, self.body_length = deserialize_non_framed_values(

test/functional/test_f_aws_encryption_sdk_client.py

+27-6
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,17 @@ def test_decrypt_minimal_source_stream_api(frame_length, wrapping_class):
810810
assert plaintext == decrypted
811811

812812

813+
def _assert_deprecated_but_not_yet_removed(logcap, instance, attribute_name, error_message, no_later_than):
814+
assert hasattr(instance, attribute_name)
815+
assert error_message in logcap.text
816+
assert aws_encryption_sdk.__version__ < no_later_than
817+
818+
819+
def _assert_decrypted_and_removed(instance, attribute_name, removed_in):
820+
assert not hasattr(instance, attribute_name)
821+
assert aws_encryption_sdk.__version__ >= removed_in
822+
823+
813824
@pytest.mark.parametrize("attribute, no_later_than", (("body_start", "1.4.0"), ("body_end", "1.4.0")))
814825
def test_decryptor_deprecated_attributes(caplog, attribute, no_later_than):
815826
caplog.set_level(logging.WARNING)
@@ -820,9 +831,19 @@ def test_decryptor_deprecated_attributes(caplog, attribute, no_later_than):
820831
decrypted = decryptor.read()
821832

822833
assert decrypted == plaintext
823-
assert hasattr(decryptor, attribute)
824-
watch_string = "StreamDecryptor.{name} is deprecated and will be removed in {version}".format(
825-
name=attribute, version=no_later_than
826-
)
827-
assert watch_string in caplog.text
828-
assert aws_encryption_sdk.__version__ < no_later_than
834+
if aws_encryption_sdk.__version__ < no_later_than:
835+
_assert_deprecated_but_not_yet_removed(
836+
logcap=caplog,
837+
instance=decryptor,
838+
attribute_name=attribute,
839+
error_message="StreamDecryptor.{name} is deprecated and will be removed in {version}".format(
840+
name=attribute, version=no_later_than
841+
),
842+
no_later_than=no_later_than
843+
)
844+
else:
845+
_assert_decrypted_and_removed(
846+
instance=decryptor,
847+
attribute_name=attribute,
848+
removed_in=no_later_than
849+
)

test/unit/test_streaming_client_stream_decryptor.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,8 @@ def test_prep_non_framed(self):
238238
stream=test_decryptor.source_stream, header=self.mock_header, verifier=sentinel.verifier
239239
)
240240
assert test_decryptor.body_length == len(VALUES["data_128"])
241-
assert test_decryptor.body_start == self.mock_header.algorithm.iv_len + 8
242-
assert test_decryptor.body_end == self.mock_header.algorithm.iv_len + 8 + len(VALUES["data_128"])
241+
assert test_decryptor._body_start == self.mock_header.algorithm.iv_len + 8
242+
assert test_decryptor._body_end == self.mock_header.algorithm.iv_len + 8 + len(VALUES["data_128"])
243243

244244
def test_read_bytes_from_non_framed(self):
245245
ct_stream = io.BytesIO(VALUES["data_128"])

0 commit comments

Comments
 (0)