Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 420497 - dev-python/pycairo-1.[8.10,10.0] changes that see pypy pass test suite.
Summary: dev-python/pycairo-1.[8.10,10.0] changes that see pypy pass test suite.
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2012-06-10 14:40 UTC by Ian Delaney (RETIRED)
Modified: 2012-11-06 06:11 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Delaney (RETIRED) gentoo-dev 2012-06-10 14:40:40 UTC
Firstly, unrestrict pypy.
RESTRICT_PYTHON_ABIS="2.4 2.5 3.0 *-jython"

right;


archtester pycairo # USE_PYTHON="2.5 2.6 3.1 2.7-pypy-1.8 2.7-pypy-1.9" ebuild pycairo-1.10.0-r2.ebuild clean test

 * Testing of dev-python/pycairo-1.10.0-r2 with CPython 2.6...
============================= test session starts ==============================
platform linux2 -- Python 2.6.8 -- pytest-2.2.3
collected 7 items 

../pycairo-1.10.0-2.6/test/api_test.py ......
../pycairo-1.10.0-2.6/test/examples_test.py .

=========================== 7 passed in 0.64 seconds ===========================
 * Testing of dev-python/pycairo-1.10.0-r2 with CPython 3.1...
============================= test session starts ==============================
platform linux2 -- Python 3.1.4 -- pytest-2.2.3
collected 7 items 

../pycairo-1.10.0-3.1/test/api_test.py ......
../pycairo-1.10.0-3.1/test/examples_test.py .

=========================== 7 passed in 0.78 seconds =========================
 * Testing of dev-python/pycairo-1.10.0-r2 with PyPy 1.8 (Python 2.7)...
============================= test session starts ============================
platform linux2 -- Python 2.7.2[pypy-1.8.0-final] -- pytest-2.2.3
collected 7 items 

../pycairo-1.10.0-2.7-pypy-1.8/test/api_test.py ......
../pycairo-1.10.0-2.7-pypy-1.8/test/examples_test.py .

=========================== 7 passed in 0.92 seconds =========================
 * Testing of dev-python/pycairo-1.10.0-r2 with PyPy 1.9 (Python 2.7)...
============================= test session starts ============================
platform linux2 -- Python 2.7.2[pypy-1.9.0-final] -- pytest-2.2.3
collected 7 items 

../pycairo-1.10.0-2.7-pypy-1.9/test/api_test.py ......
../pycairo-1.10.0-2.7-pypy-1.9/test/examples_test.py .

=========================== 7 passed in 1.60 seconds =========================

The way the latest ebuild is structured for src_test();

the original line was close to if not exactly
python_execute_py.test -P '{T}/tests${PYTHON_ABI}${EPREFIX}"$(python_get_sitedir)'

after the custom installation of the tests and the whole shebang under ${T}.
pypy is (it can be seen above) capable of passing the test suite.  What breaks it doing so is merely nomenclature. It's not that python_execute_py.test can only work with CPython, it's that the path set in -P 'path' only returns a correct path for CPython versions.  Enter pypy and it errors out with can't find the cairo folder and pycairo modules.

The path returned by python_get_sitedir for a pypy ABI yields

"usr/lib64/pypy1.8/site-packages"

The path created by the custom installation of tests creates

"usr/lib64/python2.7/site-packages"

So all we need do is substitute pypy1.8 with python2.7
I tried for hours to do it retaining python_execute_py.test, but it seems it can't be done.  It takes only two options, and they can't account for the distinct paths. To capture all possibilities as above, the path to edit becomes

${T}/tests/2.7-pypy-1.?/usr/{lib$ARCH}/python2.7/site-packages/

To capture 2.7-pypy-1.?, && lib directory inside $(python_get_sitedir),
I can't find any way of doing it without a testing(); you need to access ${PYTHON_ABI} or $(python_get_version) and then do a substitution in a variable that is assigned $(python_get_sitedir).
If it can be done with python_execute_py.test, well and good, but I can't figure it, and I don't see any loss in calling on py.test in a testing()

So; I shan't bother with a patch;
RESTRICT_PYTHON_ABIS="2.5 3.0 *-jython"     and I wonder about 3.0

src_test() {
        test_installation() {
                ./waf install --destdir="${T}/tests/${PYTHON_ABI}"
        }
        python_execute_function -q -s test_installation

        testing() {
                # Need a variable for the pypy minor version and a variable to set 2 distinct pythonpaths
                local pypy_v= PyPath= exit_status=0
                pypy_v=$(python_get_version)
                if [[ "${PYTHON_ABI:4:4}" == "pypy" ]]; then
                        PyPath=$(find "${T}"/tests/2.7-pypy-$pypy_v/ -name site-packages)
                        PYTHONPATH="${PyPath}" py.test-${PYTHON_ABI} "${WORKDIR}/${P}-${PYTHON_ABI}"/test || exit_status=1
                else
                        PyPath="${T}/tests/${PYTHON_ABI}${EPREFIX}"$(python_get_sitedir)
                        PYTHONPATH="${PyPath}" py.test "${WORKDIR}/${P}-${PYTHON_ABI}"/test || exit_status=1
                fi
                return $exit_status
        }
        python_execute_function testing
}

Let's call it a PATCH && a REQUEST for testing.
One down, dozens more to go
Comment 1 Ian Delaney (RETIRED) gentoo-dev 2012-11-06 06:11:55 UTC
  06 Nov 2012; Ian Delaney <idella4@gentoo.org> pycairo-1.10.0-r2.ebuild:
  python 2.4, pypy removed from RESTRICT_PYTHON_ABIS, test phase updated
  implementing pypy, fixes Bug #420497