From 3fb5f62b02f812da85e818e80a1dd3c229df41c1 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sun, 15 Sep 2024 15:36:16 -0700 Subject: python3-pytest-mock: Upgrade to 3.14.0 Signed-off-by: Khem Raj --- .../python/python3-pytest-mock/403.patch | 92 ---------------------- .../python/python3-pytest-mock_3.12.0.bb | 33 -------- .../python/python3-pytest-mock_3.14.0.bb | 33 ++++++++ 3 files changed, 33 insertions(+), 125 deletions(-) delete mode 100644 meta-python/recipes-devtools/python/python3-pytest-mock/403.patch delete mode 100644 meta-python/recipes-devtools/python/python3-pytest-mock_3.12.0.bb create mode 100644 meta-python/recipes-devtools/python/python3-pytest-mock_3.14.0.bb diff --git a/meta-python/recipes-devtools/python/python3-pytest-mock/403.patch b/meta-python/recipes-devtools/python/python3-pytest-mock/403.patch deleted file mode 100644 index 6787c2a3dc..0000000000 --- a/meta-python/recipes-devtools/python/python3-pytest-mock/403.patch +++ /dev/null @@ -1,92 +0,0 @@ -From 8480bb6d0500f933be039cfec65e04157e6ecffe Mon Sep 17 00:00:00 2001 -From: Bruno Oliveira -Date: Tue, 19 Dec 2023 08:24:23 -0300 -Subject: [PATCH 1/3] Fix tests for Python 3.11 and 3.12 - -Fixes #401. -Upstream-Status: Backport [https://github.com/pytest-dev/pytest-mock/pull/403] -Signed-off-by: Khem Raj ---- - tests/test_pytest_mock.py | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/tests/test_pytest_mock.py b/tests/test_pytest_mock.py -index 3ee00da..7acb361 100644 ---- a/tests/test_pytest_mock.py -+++ b/tests/test_pytest_mock.py -@@ -246,9 +246,8 @@ def __test_failure_message(self, mocker: MockerFixture, **kwargs: Any) -> None: - msg = "Expected call: {0}()\nNot called" - expected_message = msg.format(expected_name) - stub = mocker.stub(**kwargs) -- with pytest.raises(AssertionError) as exc_info: -+ with pytest.raises(AssertionError, match=re.escape(expected_message)) as exc_info: - stub.assert_called_with() -- assert str(exc_info.value) == expected_message - - def test_failure_message_with_no_name(self, mocker: MagicMock) -> None: - self.__test_failure_message(mocker) - -From c596504e062be06475b03122c9c0cc732ae87840 Mon Sep 17 00:00:00 2001 -From: "pre-commit-ci[bot]" - <66853113+pre-commit-ci[bot]@users.noreply.github.com> -Date: Tue, 19 Dec 2023 11:24:38 +0000 -Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks - -for more information, see https://pre-commit.ci ---- - tests/test_pytest_mock.py | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/tests/test_pytest_mock.py b/tests/test_pytest_mock.py -index 7acb361..c185f2a 100644 ---- a/tests/test_pytest_mock.py -+++ b/tests/test_pytest_mock.py -@@ -246,7 +246,9 @@ def __test_failure_message(self, mocker: MockerFixture, **kwargs: Any) -> None: - msg = "Expected call: {0}()\nNot called" - expected_message = msg.format(expected_name) - stub = mocker.stub(**kwargs) -- with pytest.raises(AssertionError, match=re.escape(expected_message)) as exc_info: -+ with pytest.raises( -+ AssertionError, match=re.escape(expected_message) -+ ) as exc_info: - stub.assert_called_with() - - def test_failure_message_with_no_name(self, mocker: MagicMock) -> None: - -From 6da5b0506d6378a8dbe5ae314d5134e6868aeabd Mon Sep 17 00:00:00 2001 -From: danigm -Date: Wed, 20 Dec 2023 16:02:13 +0100 -Subject: [PATCH 3/3] Update expected message to match python 3.11.7 (#404) - -https://github.com/python/cpython/issues/111019 - -Fixes #401. -Closes #403. ---- - tests/test_pytest_mock.py | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/tests/test_pytest_mock.py b/tests/test_pytest_mock.py -index c185f2a..01534a4 100644 ---- a/tests/test_pytest_mock.py -+++ b/tests/test_pytest_mock.py -@@ -25,6 +25,8 @@ - - # Python 3.8 changed the output formatting (bpo-35500), which has been ported to mock 3.0 - NEW_FORMATTING = sys.version_info >= (3, 8) -+# Python 3.11.7 changed the output formatting, https://github.com/python/cpython/issues/111019 -+NEWEST_FORMATTING = sys.version_info >= (3, 11, 7) - - if sys.version_info[:2] >= (3, 8): - from unittest.mock import AsyncMock -@@ -240,7 +242,9 @@ def test_repr_with_name(self, mocker: MockerFixture) -> None: - - def __test_failure_message(self, mocker: MockerFixture, **kwargs: Any) -> None: - expected_name = kwargs.get("name") or "mock" -- if NEW_FORMATTING: -+ if NEWEST_FORMATTING: -+ msg = "expected call not found.\nExpected: {0}()\n Actual: not called." -+ elif NEW_FORMATTING: - msg = "expected call not found.\nExpected: {0}()\nActual: not called." - else: - msg = "Expected call: {0}()\nNot called" diff --git a/meta-python/recipes-devtools/python/python3-pytest-mock_3.12.0.bb b/meta-python/recipes-devtools/python/python3-pytest-mock_3.12.0.bb deleted file mode 100644 index e9a9a4fbc5..0000000000 --- a/meta-python/recipes-devtools/python/python3-pytest-mock_3.12.0.bb +++ /dev/null @@ -1,33 +0,0 @@ -SUMMARY = "Thin-wrapper around the mock package for easier use with pytest" -HOMEPAGE = "https://github.com/pytest-dev/pytest-mock/" -LICENSE = "MIT" -LIC_FILES_CHKSUM = " \ - file://LICENSE;md5=b2ddb1e69238461b7e4ef2a84d874109 \ -" - -SRC_URI = " \ - git://github.com/pytest-dev/pytest-mock;branch=main;protocol=https \ - file://run-ptest \ - file://0001-test_pytest_mock-skip-args-introspection-tests.patch \ - file://403.patch \ -" -SRCREV = "69adc6f76c1a7baf4e7a728da9eec38741d5783e" - -inherit setuptools3 ptest - -DEPENDS += "python3-setuptools-scm-native" - -RDEPENDS:${PN} += " \ - python3-asyncio \ - python3-pytest \ - python3-pytest-asyncio \ - python3-unittest \ - python3-unittest-automake-output \ -" - -S = "${WORKDIR}/git" - -do_install_ptest() { - install -d ${D}${PTEST_PATH}/tests - cp -rf ${S}/tests ${D}${PTEST_PATH}/ -} diff --git a/meta-python/recipes-devtools/python/python3-pytest-mock_3.14.0.bb b/meta-python/recipes-devtools/python/python3-pytest-mock_3.14.0.bb new file mode 100644 index 0000000000..fe2479c836 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-pytest-mock_3.14.0.bb @@ -0,0 +1,33 @@ +SUMMARY = "Thin-wrapper around the mock package for easier use with pytest" +HOMEPAGE = "https://github.com/pytest-dev/pytest-mock/" +LICENSE = "MIT" +LIC_FILES_CHKSUM = " \ + file://LICENSE;md5=b2ddb1e69238461b7e4ef2a84d874109 \ +" + +SRC_URI = " \ + git://github.com/pytest-dev/pytest-mock;branch=main;protocol=https \ + file://0001-test_pytest_mock-skip-args-introspection-tests.patch \ + file://run-ptest \ +" +SRCREV = "8733134b6194395e9cd3c745adcc9a9c09b0279e" + +inherit python_setuptools_build_meta ptest + +DEPENDS += "python3-setuptools-scm-native" + +RDEPENDS:${PN} += " \ + python3-asyncio \ + python3-mock \ + python3-pytest \ + python3-pytest-asyncio \ + python3-unittest \ + python3-unittest-automake-output \ +" + +S = "${WORKDIR}/git" + +do_install_ptest() { + install -d ${D}${PTEST_PATH}/tests + cp -rf ${S}/tests ${D}${PTEST_PATH}/ +} -- cgit v1.2.3-54-g00ecf