From b2436fc20d9d78875ab3d2b5790d154dfb72e866 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Thu, 26 Sep 2024 11:02:06 -0700 Subject: python3-pytest-mock: Fix ptests - Drop the patch to add additional checks to disable failing introspection tests, use plain asserts instead - Switch to pypi fetcher - Add missing rdeps needed for ptest runs Signed-off-by: Khem Raj Cc: Trevor Gamblin Signed-off-by: Armin Kuster --- ...pytest_mock-skip-args-introspection-tests.patch | 38 ---------------------- .../python/python3-pytest-mock/run-ptest | 4 +-- .../python/python3-pytest-mock_3.14.0.bb | 19 +++++------ 3 files changed, 11 insertions(+), 50 deletions(-) delete mode 100644 meta-python/recipes-devtools/python/python3-pytest-mock/0001-test_pytest_mock-skip-args-introspection-tests.patch diff --git a/meta-python/recipes-devtools/python/python3-pytest-mock/0001-test_pytest_mock-skip-args-introspection-tests.patch b/meta-python/recipes-devtools/python/python3-pytest-mock/0001-test_pytest_mock-skip-args-introspection-tests.patch deleted file mode 100644 index f024e79d93..0000000000 --- a/meta-python/recipes-devtools/python/python3-pytest-mock/0001-test_pytest_mock-skip-args-introspection-tests.patch +++ /dev/null @@ -1,38 +0,0 @@ -From e184fb950ad3b52c5c16438d39fe4d516c784e30 Mon Sep 17 00:00:00 2001 -From: Trevor Gamblin -Date: Thu, 12 Oct 2023 17:32:40 -0400 -Subject: [PATCH] test_pytest_mock: skip args introspection tests - -Disable these two tests for now so that python3-pytest-mock can have -successful ptest runs. - -Upstream-Status: Inappropriate [OE-Specific] - -Signed-off-by: Trevor Gamblin ---- - tests/test_pytest_mock.py | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/tests/test_pytest_mock.py b/tests/test_pytest_mock.py -index 3d53241..157b6c3 100644 ---- a/tests/test_pytest_mock.py -+++ b/tests/test_pytest_mock.py -@@ -581,6 +581,7 @@ def test_assert_called_wrapper(mocker: MockerFixture) -> None: - stub.assert_called() - - -+@pytest.mark.skip("Async not correctly detected, skip for now") - @pytest.mark.usefixtures("needs_assert_rewrite") - def test_assert_called_args_with_introspection(mocker: MockerFixture) -> None: - stub = mocker.stub() -@@ -597,6 +598,7 @@ def test_assert_called_args_with_introspection(mocker: MockerFixture) -> None: - stub.assert_called_once_with(*wrong_args) - - -+@pytest.mark.skip("Async not correctly detected, skip for now") - @pytest.mark.usefixtures("needs_assert_rewrite") - def test_assert_called_kwargs_with_introspection(mocker: MockerFixture) -> None: - stub = mocker.stub() --- -2.41.0 - diff --git a/meta-python/recipes-devtools/python/python3-pytest-mock/run-ptest b/meta-python/recipes-devtools/python/python3-pytest-mock/run-ptest index 8d2017d39c..51ae892b01 100644 --- a/meta-python/recipes-devtools/python/python3-pytest-mock/run-ptest +++ b/meta-python/recipes-devtools/python/python3-pytest-mock/run-ptest @@ -1,3 +1,3 @@ #!/bin/sh - -pytest --automake +# see https://github.com/pytest-dev/pytest-mock/issues/102 for reasons to use plain asserts +pytest --automake --assert=plain 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 index fe2479c836..b968cf1cd4 100644 --- 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 @@ -5,28 +5,27 @@ 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 \ +SRC_URI += " \ file://run-ptest \ " -SRCREV = "8733134b6194395e9cd3c745adcc9a9c09b0279e" +SRC_URI[sha256sum] = "2719255a1efeceadbc056d6bf3df3d1c5015530fb40cf347c0f9afac88410bd0" -inherit python_setuptools_build_meta ptest +inherit pypi python_setuptools_build_meta ptest + +PYPI_PACKAGE = "pytest-mock" DEPENDS += "python3-setuptools-scm-native" -RDEPENDS:${PN} += " \ - python3-asyncio \ +RDEPENDS:${PN}-ptest += " \ + python3-misc \ python3-mock \ python3-pytest \ python3-pytest-asyncio \ - python3-unittest \ + python3-threading \ + python3-tox \ 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