On Fri, Mar 15, 2019 at 09:48:39AM +0000, Stuart Henderson wrote:
> I'd really like if this could be factored into the module so we can get rid
> of copies all over the tree.. perhaps behind a MODPY_PYTEST=Yes and using
> something like MODPY_PYTEST_FLAGS for those that need more than just -m
> pytest?

Why don't we add it by default for lang/python module ports?
I mean, would it hurt anything?

> --
> Sent from a phone, apologies for poor formatting.
> 
> On 15 March 2019 05:38:44 Kurt Mosiejczuk <[email protected]> wrote:
> 
> > After sending my diff for productivity/khal that added UTF-8 via a
> > new TEST_DEPENDS and modified do-test target I decided I would look
> > throughout the ports tree rather than doing it as I stumbled across it
> > in individual ports as I worked.
> > 
> > 
> > I went through all the python ports I found with a do-test that had a
> > pytest construct in them. Many of the ports had no tests that failed
> > because of unicode reasons so I skipped those. The ones that had
> > failures because of unicode complaints about ascii versus UTF-8 I added
> > a TEST_ENV and modified the do-test target. I verified that doing this
> > improved test results in each case.
> > 
> > 
> > From there I found python ports that already had UTF-8 factored in but
> > did so via a direct inclusion in the test invocation. I abstracted those
> > out and brought in the full SETENV, MAKE_ENV, and TEST_ENV variables
> > in the invocation. Each of those I tested again and the tests came out
> > identically.
> > 
> > 
> > The latter part is more trying to normalize python ports doing this to a
> > common construct. I do have a version that skips those and just does the
> > ports where it improves test results if that is preferred.
> > 
> > 
> > Whereas none of this work touches things outside of tests, I did not
> > bump the revision on any of these.
> > 
> > 
> > cc'ing shadchin@ sebastia@ and remi@ since one or more of the ports this
> > touches are theirs.
> > 
> > 
> > --Kurt
> > 
> > 
> > Index: devel/py-cairocffi/Makefile
> > ===================================================================
> > RCS file: /cvs/ports/devel/py-cairocffi/Makefile,v
> > retrieving revision 1.1.1.1
> > diff -u -p -r1.1.1.1 Makefile
> > --- devel/py-cairocffi/Makefile 19 Feb 2017 19:11:58 -0000 1.1.1.1
> > +++ devel/py-cairocffi/Makefile 15 Mar 2019 04:43:01 -0000
> > @@ -27,7 +27,10 @@ MODPY_SETUPTOOLS = Yes
> > FLAVORS = python3
> > FLAVOR ?=
> > 
> > +TEST_ENV += LC_CTYPE=en_US.UTF-8
> > +
> > do-test:
> > - cd ${WRKSRC}/lib && LC_CTYPE=en_US.UTF-8 ${MODPY_BIN} -m pytest cairocffi
> > + cd ${WRKSRC}/lib && exec ${SETENV} ${MAKE_ENV} ${TEST_ENV} \
> > + ${MODPY_BIN} -m pytest cairocffi
> > 
> > .include <bsd.port.mk>
> > Index: devel/py-click/Makefile
> > ===================================================================
> > RCS file: /cvs/ports/devel/py-click/Makefile,v
> > retrieving revision 1.5
> > diff -u -p -r1.5 Makefile
> > --- devel/py-click/Makefile 15 Apr 2017 17:25:39 -0000 1.5
> > +++ devel/py-click/Makefile 15 Mar 2019 04:43:01 -0000
> > @@ -25,8 +25,10 @@ FLAVORS= python3
> > FLAVOR?=
> > 
> > TEST_DEPENDS= devel/py-test${MODPY_FLAVOR}
> > +TEST_ENV += LC_CTYPE=C.UTF-8
> > 
> > do-test:
> > - @cd ${WRKSRC} && ${MODPY_BIN} -m pytest
> > + @cd ${WRKSRC} && exec ${SETENV} ${MAKE_ENV} ${TEST_ENV} \
> > + ${MODPY_BIN} -m pytest
> > 
> > .include <bsd.port.mk>
> > Index: devel/py-lazy-object-proxy/Makefile
> > ===================================================================
> > RCS file: /cvs/ports/devel/py-lazy-object-proxy/Makefile,v
> > retrieving revision 1.3
> > diff -u -p -r1.3 Makefile
> > --- devel/py-lazy-object-proxy/Makefile 11 May 2017 18:45:11 -0000 1.3
> > +++ devel/py-lazy-object-proxy/Makefile 15 Mar 2019 04:43:02 -0000
> > @@ -27,7 +27,10 @@ TEST_DEPENDS = devel/py-test${MODPY_FLA
> > FLAVORS = python3
> > FLAVOR ?=
> > 
> > +TEST_ENV += LC_CTYPE=C.UTF-8
> > +
> > do-test:
> > - @cd ${WRKSRC} && LC_CTYPE=C.UTF-8 ${MODPY_BIN} -m pytest --ignore=src
> > + @cd ${WRKSRC} && exec ${SETENV} ${MAKE_ENV} ${TEST_ENV} \
> > + ${MODPY_BIN} -m pytest --ignore=src
> > 
> > .include <bsd.port.mk>
> > Index: devel/py-nbconvert/Makefile
> > ===================================================================
> > RCS file: /cvs/ports/devel/py-nbconvert/Makefile,v
> > retrieving revision 1.6
> > diff -u -p -r1.6 Makefile
> > --- devel/py-nbconvert/Makefile 25 May 2017 11:45:25 -0000 1.6
> > +++ devel/py-nbconvert/Makefile 15 Mar 2019 04:43:02 -0000
> > @@ -45,7 +45,10 @@ TEST_DEPENDS = ${BASE_PKGPATH}=${MODPY_
> > post-install:
> >  mv ${PREFIX}/bin/jupyter-nbconvert{,${MODPY_BIN_SUFFIX}}
> > 
> > +TEST_ENV += LC_CTYPE=en_US.UTF-8
> > +
> > do-test:
> > - cd ${WRKSRC} && LC_CTYPE=en_US.UTF-8 ${MODPY_BIN} -m pytest nbconvert
> > + cd ${WRKSRC} && exec ${SETENV} ${MAKE_ENV} ${TEST_ENV} \
> > + ${MODPY_BIN} -m pytest nbconvert
> > 
> > .include <bsd.port.mk>
> > Index: devel/py-nbformat/Makefile
> > ===================================================================
> > RCS file: /cvs/ports/devel/py-nbformat/Makefile,v
> > retrieving revision 1.4
> > diff -u -p -r1.4 Makefile
> > --- devel/py-nbformat/Makefile 23 Feb 2017 11:52:00 -0000 1.4
> > +++ devel/py-nbformat/Makefile 15 Mar 2019 04:43:02 -0000
> > @@ -29,10 +29,13 @@ MODPY_PI = Yes
> > FLAVORS = python3
> > FLAVOR ?=
> > 
> > +TEST_ENV += LC_CTYPE=en_US.UTF-8
> > +
> > post-install:
> >  mv ${PREFIX}/bin/jupyter-trust 
> > ${PREFIX}/bin/jupyter-trust${MODPY_BIN_SUFFIX}
> > 
> > do-test:
> > - cd ${WRKSRC} && LC_CTYPE=en_US.UTF-8 ${MODPY_BIN} -m pytest nbformat
> > + cd ${WRKSRC} && exec ${SETENV} ${MAKE_ENV} ${TEST_ENV} \
> > + ${MODPY_BIN} -m pytest nbformat
> > 
> > .include <bsd.port.mk>
> > Index: devel/py-path.py/Makefile
> > ===================================================================
> > RCS file: /cvs/ports/devel/py-path.py/Makefile,v
> > retrieving revision 1.11
> > diff -u -p -r1.11 Makefile
> > --- devel/py-path.py/Makefile 22 Apr 2017 17:23:54 -0000 1.11
> > +++ devel/py-path.py/Makefile 15 Mar 2019 04:43:02 -0000
> > @@ -27,7 +27,10 @@ TEST_DEPENDS = devel/py-appdirs${MODPY_
> > FLAVORS = python3
> > FLAVOR ?=
> > 
> > +TEST_ENV += LC_CTYPE=C.UTF-8
> > +
> > do-test:
> > - cd ${WRKSRC} && LC_CTYPE=C.UTF-8 ${MODPY_BIN} -m pytest --ignore=lib
> > + cd ${WRKSRC} && exec ${SETENV} ${MAKE_ENV} ${TEST_ENV} \
> > + ${MODPY_BIN} -m pytest --ignore=lib
> > 
> > .include <bsd.port.mk>
> > Index: devel/py-pexpect/Makefile
> > ===================================================================
> > RCS file: /cvs/ports/devel/py-pexpect/Makefile,v
> > retrieving revision 1.27
> > diff -u -p -r1.27 Makefile
> > --- devel/py-pexpect/Makefile 3 Jan 2017 19:19:49 -0000 1.27
> > +++ devel/py-pexpect/Makefile 15 Mar 2019 04:43:02 -0000
> > @@ -23,6 +23,7 @@ RUN_DEPENDS = devel/py-ptyprocess${MODP
> > BUILD_DEPENDS = ${RUN_DEPENDS} \
> >  textproc/py-sphinx${MODPY_FLAVOR}
> > TEST_DEPENDS = ${RUN_DEPENDS} \
> > + devel/py-ptyprocess${MODPY_FLAVOR} \
> >  devel/py-test${MODPY_FLAVOR} \
> >  shells/bash
> > 
> > @@ -36,6 +37,8 @@ DOCDIR= ${PREFIX}/share/doc/${MODPY_PY
> > 
> > MAKE_ENV += PYTHONPATH=${WRKSRC}
> > 
> > +TEST_ENV += LC_CTYPE=C.UTF-8
> > +
> > pre-build:
> >  ${SUBST_CMD} ${WRKSRC}/pexpect/replwrap.py
> >  ${SUBST_CMD} ${WRKSRC}/tests/test_ctrl_chars.py
> > @@ -54,6 +57,7 @@ post-install:
> >  cd ${WRKSRC}/doc/_build/html && pax -rw * ${DOCDIR}
> > 
> > do-test:
> > - cd ${WRKSRC} && ${MODPY_BIN} -m pytest
> > + cd ${WRKSRC} && exec ${SETENV} ${MAKE_ENV} ${TEST_ENV} \
> > + ${MODPY_BIN} -m pytest
> > 
> > .include <bsd.port.mk>
> > Index: net/poezio/Makefile
> > ===================================================================
> > RCS file: /cvs/ports/net/poezio/Makefile,v
> > retrieving revision 1.7
> > diff -u -p -r1.7 Makefile
> > --- net/poezio/Makefile 6 Sep 2018 15:50:41 -0000 1.7
> > +++ net/poezio/Makefile 15 Mar 2019 04:43:14 -0000
> > @@ -32,7 +32,10 @@ TEST_DEPENDS = ${RUN_DEPENDS} \
> >  ${FULLPKGNAME}:${BUILD_PKGPATH} \
> >  devel/py-test${MODPY_FLAVOR}
> > 
> > +TEST_ENV += LC_CTYPE=C.UTF-8
> > +
> > do-test:
> > - @cd ${WRKSRC} && ${MODPY_BIN} -m pytest -v test/
> > + @cd ${WRKSRC} && exec ${SETENV} ${MAKE_ENV} ${TEST_ENV} \
> > + ${MODPY_BIN} -m pytest -v test/
> > 
> > .include <bsd.port.mk>
> > Index: productivity/vdirsyncer/Makefile
> > ===================================================================
> > RCS file: /cvs/ports/productivity/vdirsyncer/Makefile,v
> > retrieving revision 1.7
> > diff -u -p -r1.7 Makefile
> > --- productivity/vdirsyncer/Makefile 16 Aug 2018 21:37:55 -0000 1.7
> > +++ productivity/vdirsyncer/Makefile 15 Mar 2019 04:43:23 -0000
> > @@ -37,6 +37,10 @@ TEST_DEPENDS = devel/py-hypothesis${MOD
> >  www/py-urllib3${MODPY_FLAVOR} \
> >  ${RUN_DEPENDS}
> > 
> > +TEST_ENV += LC_CTYPE=C.UTF-8 \
> > + DAV_SERVER=skip \
> > + DETERMINISTIC_TESTS=true
> > +
> > post-build:
> >  cd ${WRKSRC}/docs; ${MAKE_ENV} PYTHONPATH=${WRKSRC} \
> >  sphinx-build${MODPY_BIN_SUFFIX} \
> > @@ -54,7 +58,7 @@ post-install:
> >  ${PREFIX}/share/examples/vdirsyncer
> > 
> > do-test:
> > - cd ${WRKSRC}; DAV_SERVER=skip DETERMINISTIC_TESTS=true \
> > + cd ${WRKSRC} && exec ${SETENV} ${MAKE_ENV} ${TEST_ENV} \
> >  ${MODPY_BIN} -m pytest tests/
> > 
> > .include <bsd.port.mk>
> > Index: www/py-flask/Makefile
> > ===================================================================
> > RCS file: /cvs/ports/www/py-flask/Makefile,v
> > retrieving revision 1.26
> > diff -u -p -r1.26 Makefile
> > --- www/py-flask/Makefile 2 Jul 2018 17:49:16 -0000 1.26
> > +++ www/py-flask/Makefile 15 Mar 2019 04:43:28 -0000
> > @@ -32,7 +32,10 @@ BUILD_DEPENDS = textproc/py-sphinx${MOD
> > TEST_DEPENDS = ${RUN_DEPENDS} \
> >  devel/py-test${MODPY_FLAVOR}
> > 
> > -MAKE_ENV = PYTHONPATH="${WRKSRC}"
> > SPHINXBUILD=${LOCALBASE}/bin/sphinx-build${MODPY_BIN_SUFFIX}
> > +MAKE_ENV = PYTHONPATH="${WRKSRC}" \
> > + SPHINXBUILD=${LOCALBASE}/bin/sphinx-build${MODPY_BIN_SUFFIX}
> > +
> > +TEST_ENV += LC_ALL=C.UTF-8
> > 
> > post-install:
> >  ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/${MODPY_PY_PREFIX}flask
> > @@ -41,6 +44,7 @@ post-install:
> >  mv ${PREFIX}/bin/flask ${PREFIX}/bin/flask${MODPY_BIN_SUFFIX}
> > 
> > do-test:
> > - cd ${WRKSRC} && LC_ALL=C.UTF-8 ${MODPY_BIN} -m pytest tests
> > + cd ${WRKSRC} && exec ${SETENV} ${MAKE_ENV} ${TEST_ENV} \
> > + ${MODPY_BIN} -m pytest tests
> > 
> > .include <bsd.port.mk>
> 
> 
> 

-- 
Antoine

Reply via email to