From 0ef7acef765690f99075888d6c3e6f03d7cc2d59 Mon Sep 17 00:00:00 2001 From: Romain Marcadier Date: Tue, 18 Jul 2023 18:58:26 +0200 Subject: [PATCH] feat(python): deprecation message when using Python <= 3.7 (#4186) As Python 3.7 has reached end-of-life on 2023-06-27, we will now be warning customers using it, and prompting them to upgrade to Python 3.8 or newer at their earliest convenience. --- By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license]. [Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0 --- packages/@jsii/python-runtime/src/jsii/__init__.py | 4 ++-- packages/@jsii/python-runtime/tests/test_invoke_bin.py | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/@jsii/python-runtime/src/jsii/__init__.py b/packages/@jsii/python-runtime/src/jsii/__init__.py index 9eaf7dd80b..20dcc97b43 100644 --- a/packages/@jsii/python-runtime/src/jsii/__init__.py +++ b/packages/@jsii/python-runtime/src/jsii/__init__.py @@ -37,12 +37,12 @@ stats = kernel.stats -if sys.version_info < (3, 7): +if sys.version_info < (3, 8): from platform import python_version import warnings warnings.warn( - f"WARNING: You are using python release {python_version()}, which has reached end-of-life! Support for EOL Python releases may be dropped in the future. Please consider upgrading to Python >= 3.7 as soon as possible.", + f"WARNING: You are using python release {python_version()}, which has reached end-of-life! Support for EOL Python releases may be dropped in the future. Please consider upgrading to Python >= 3.8 as soon as possible.", ) diff --git a/packages/@jsii/python-runtime/tests/test_invoke_bin.py b/packages/@jsii/python-runtime/tests/test_invoke_bin.py index 763afc56ac..8ff6a94271 100644 --- a/packages/@jsii/python-runtime/tests/test_invoke_bin.py +++ b/packages/@jsii/python-runtime/tests/test_invoke_bin.py @@ -44,7 +44,6 @@ def test_invoke_script(self, silence_node_deprecation_warnings) -> None: assert result.returncode == 0 assert result.stdout == b"Hello World!\n" - assert result.stderr == b"" @pytest.mark.skipif( platform.system() == "Windows", @@ -56,7 +55,6 @@ def test_invoke_script_with_args(self, silence_node_deprecation_warnings) -> Non assert result.returncode == 0 assert result.stdout == b"Hello World!\n arguments: arg1, arg2\n" - assert result.stderr == b"" @pytest.mark.skipif( platform.system() == "Windows", @@ -70,7 +68,7 @@ def test_invoke_script_with_failure( assert result.returncode == 3 assert result.stdout == b"Hello World!\n arguments: arg1, fail\n" - assert result.stderr == b"error message to stderr\n" + assert result.stderr.startswith(b"error message to stderr\n") @pytest.mark.skipif( platform.system() == "Windows",