Re: [OE-core] [PATCH v3 4/8] python-numpy: Add ptest

Khem Raj
2020-11-28T21:03:51Z

On Sat, Nov 28, 2020 at 10:57 AM Tim Orling <ticotimo@gmail.com> wrote:
>
>
>
> On Fri, Nov 20, 2020 at 9:30 AM Khem Raj <raj.khem@gmail.com> wrote:
>>
>> Since 1.15, numpy have replaced nose with pytest testing framework
>> it additionally needs hypothesis and sortedcontainers modules
>>
>> Signed-off-by: Khem Raj <raj.khem@gmail.com>
>> ---
>> meta/recipes-devtools/python-numpy/files/run-ptest | 5 +++++
>> meta/recipes-devtools/python-numpy/python3-numpy_1.19.4.bb | 7 +++++--
>> 2 files changed, 10 insertions(+), 2 deletions(-)
>> create mode 100644 meta/recipes-devtools/python-numpy/files/run-ptest
>>
>> diff --git a/meta/recipes-devtools/python-numpy/files/run-ptest b/meta/recipes-devtools/python-numpy/files/run-ptest
>> new file mode 100644
>> index 0000000000..9a1c72aeb1
>> --- /dev/null
>> +++ b/meta/recipes-devtools/python-numpy/files/run-ptest
>> @@ -0,0 +1,5 @@
>> +#!/usr/bin/env python3
>> +
>> +import numpy
>> +numpy.test(label='full', verbose=2)
>> +
>> diff --git a/meta/recipes-devtools/python-numpy/python3-numpy_1.19.4.bb b/meta/recipes-devtools/python-numpy/python3-numpy_1.19.4.bb
>> index d54f2f6c18..b484e7cddc 100644
>> --- a/meta/recipes-devtools/python-numpy/python3-numpy_1.19.4.bb
>> +++ b/meta/recipes-devtools/python-numpy/python3-numpy_1.19.4.bb
>> @@ -8,6 +8,7 @@ SRCNAME = "numpy"
>> SRC_URI = "https://github.com/${SRCNAME}/${SRCNAME}/releases/download/v${PV}/${SRCNAME}-${PV}.tar.gz \
>> file://0001-Don-t-search-usr-and-so-on-for-libraries-by-default-.patch \
>> file://0001-numpy-core-Define-RISCV-32-support.patch \
>> + file://run-ptest \
>> "
>> SRC_URI[sha256sum] = "fe836a685d6838dbb3f603caef01183ea98e88febf4ce956a2ea484a75378413"
>>
>> @@ -16,7 +17,7 @@ UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)\.tar"
>>
>> DEPENDS += "python3-cython-native"
>>
>> -inherit setuptools3
>> +inherit ptest setuptools3
>>
>> S = "${WORKDIR}/numpy-${PV}"
>>
>> @@ -30,7 +31,6 @@ RDEPENDS_${PN} = "${PYTHON_PN}-unittest \
>> ${PYTHON_PN}-pprint \
>> ${PYTHON_PN}-pickle \
>> ${PYTHON_PN}-shell \
>> - ${PYTHON_PN}-nose \
>> ${PYTHON_PN}-doctest \
>> ${PYTHON_PN}-datetime \
>> ${PYTHON_PN}-distutils \
>> @@ -39,6 +39,9 @@ RDEPENDS_${PN} = "${PYTHON_PN}-unittest \
>> ${PYTHON_PN}-netclient \__class__ = <class 'zipfile._ZipWriteFile'>
>> # and may, or may not, abort the process depending on the LAPACK package.
>>
>> XERBLA_OK = 255
>>
>> try:
>> pid = os.fork()
>> except (OSError, AttributeError):
>> # fork failed, or not running on POSIX
>> pytest.skip("Not POSIX or fork failed.")
>>
>> if pid == 0:
>> # child; close i/o file handles
>> os.close(1)
>> os.close(0)
>> # Avoid producing core files.
>> > import resource
>> E ModuleNotFoundError: No module named 'resource'
>>
>> XERBLA_OK = 255
>> pid = 0
>>
>> ../../python3.9/site-packages/numpy/linalg/tests/test_linalg.py:1808: ModuleNotFoundError
>>
>> """
>
>
>>
>> ${PYTHON_PN}-numbers \
>> ${PYTHON_PN}-pydoc \
>> + ${PYTHON_PN}-pytest \
>> + ${PYTHON_PN}-hypothesis \
>> + ${PYTHON_PN}-sortedcontainers \
>
>
> Also needs ${PYTHON_PN}-resource
>

Thanks, did you mean python3-pkg-resources ?
I did not encounter this locally and I have the above installed and
was wondering if thats the case.
but I have added this, I will send that in v4 otherwise.

> """
>
>> ${PYTHON_PN}-pkgutil \
>> ${PYTHON_PN}-email \
>> ${PYTHON_PN}-compression \
>> --
>> 2.29.2
>>
>>
>>
>>