From d1a6edade8bf4b6815bfadda05de144c7d5fc2adf950d48b1462c15672771a8b Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Tue, 13 Feb 2024 05:40:58 +0000 Subject: [PATCH] - Add patch support-moto-5.patch: * Support moto 5.0 changes. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-environ-config?expand=0&rev=10 --- python-environ-config.changes | 6 +++ python-environ-config.spec | 6 ++- support-moto-5.patch | 71 +++++++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 support-moto-5.patch diff --git a/python-environ-config.changes b/python-environ-config.changes index 78fe149..96e6023 100644 --- a/python-environ-config.changes +++ b/python-environ-config.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Feb 13 05:40:17 UTC 2024 - Steve Kowalik + +- Add patch support-moto-5.patch: + * Support moto 5.0 changes. + ------------------------------------------------------------------- Mon May 29 14:06:27 UTC 2023 - Dirk Müller diff --git a/python-environ-config.spec b/python-environ-config.spec index 3b6f0dd..120ba18 100644 --- a/python-environ-config.spec +++ b/python-environ-config.spec @@ -1,7 +1,7 @@ # # spec file for package python-environ-config # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -23,6 +23,8 @@ Summary: Boilerplate-free configuration with env variables License: MIT URL: https://github.com/hynek/environ_config Source: https://files.pythonhosted.org/packages/source/e/environ-config/environ_config-%{version}.tar.gz +# PATCH-FIX-UPSTREAM Based on gh#hynek/environ-config#76 +Patch0: support-moto-5.patch BuildRequires: %{python_module hatch-fancy-pypi-readme} BuildRequires: %{python_module hatch_vcs} BuildRequires: %{python_module hatchling} @@ -46,7 +48,7 @@ BuildRequires: %{python_module urllib3 < 2} Boilerplate-free configuration with env variables. %prep -%setup -q -n environ_config-%{version} +%autosetup -p1 -n environ_config-%{version} %build %pyproject_wheel diff --git a/support-moto-5.patch b/support-moto-5.patch new file mode 100644 index 0000000..2f16cc6 --- /dev/null +++ b/support-moto-5.patch @@ -0,0 +1,71 @@ +From 2c51eda55d152d4bd59f51a033c5976bfe05a897 Mon Sep 17 00:00:00 2001 +From: Steve Kowalik +Date: Tue, 13 Feb 2024 15:53:34 +1100 +Subject: [PATCH 1/2] Support moto 5.0 + +moto 5.0 has been released, and the major change is to pull all of the +mocking into one function. Use the new mock_aws function, but continue +to support moto 4.2, since it's easy. +--- + pyproject.toml | 2 +- + tests/test_secrets_awssm.py | 9 ++++++--- + 2 files changed, 7 insertions(+), 4 deletions(-) + +diff --git a/tests/test_secrets_awssm.py b/tests/test_secrets_awssm.py +index db999d1..90b863c 100644 +--- a/tests/test_secrets_awssm.py ++++ b/tests/test_secrets_awssm.py +@@ -23,7 +23,10 @@ + import boto3 + import pytest + +-from moto import mock_secretsmanager ++try: ++ from moto import mock_aws ++except ImportError: ++ from moto import mock_secretsmanager as mock_aws + + import environ + +@@ -62,7 +65,7 @@ def _mock_aws_credentials(force_region): + + @pytest.fixture(name="secretsmanager") + def _secretsmanager(): +- with mock_secretsmanager(): ++ with mock_aws(): + yield boto3.client("secretsmanager", region_name="us-east-2") + + +@@ -122,7 +125,7 @@ def test_secret_works_with_default_client_overridden( + class Cfg: + pw = sm.secret() + +- with mock_secretsmanager(): ++ with mock_aws(): + # we need to make sure we're using the same region. It doesn't + # matter which -- moto _and_ boto will try figure it out from the + # environment -- but it has to be the same. + +From 40a01bee6579d9265e731b9f12e6a890f68bf0c5 Mon Sep 17 00:00:00 2001 +From: "pre-commit-ci[bot]" + <66853113+pre-commit-ci[bot]@users.noreply.github.com> +Date: Tue, 13 Feb 2024 04:56:33 +0000 +Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks + +for more information, see https://pre-commit.ci +--- + tests/test_secrets_awssm.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/tests/test_secrets_awssm.py b/tests/test_secrets_awssm.py +index 90b863c..b109eb3 100644 +--- a/tests/test_secrets_awssm.py ++++ b/tests/test_secrets_awssm.py +@@ -23,6 +23,7 @@ + import boto3 + import pytest + ++ + try: + from moto import mock_aws + except ImportError: