On 8/25/24 3:07 AM, Landry Breuil wrote:
> Le Thu, Aug 22, 2024 at 10:04:45AM +0200, Landry Breuil a écrit :
>> Le Thu, Aug 22, 2024 at 09:40:23AM +0200, Landry Breuil a écrit :
>>> Le Wed, Aug 21, 2024 at 06:11:32PM +0200, Kirill A. Korinsky a écrit :
>>>> On Wed, 21 Aug 2024 17:16:11 +0200,
>>>> Landry Breuil <lan...@openbsd.org> wrote:
>>>>> Le Wed, Aug 21, 2024 at 05:00:21PM +0200, Landry Breuil a écrit :
>>>>>> Le Wed, Aug 21, 2024 at 03:49:45PM +0200, Kirill A. Korinsky a écrit :
>>>>>>> ports@,
>>>>>>>
>>>>>>> Here a ping from another diff from my
>>>>>> can you explain the dance about dropping/copying tests in pre-test ?
>>>>>> why was that needed ? isn't doing MODPY_PYTEST_ARGS = --forked enough ?
>>>>> now that i've tested, this fails with a rather strange error (strange as
>>>>> in "i dont understand why moving tests/ around helps") on all test files:
>>>>>
>>>> and I confirm that this is the problem I am overlooking by moving tests.
>> it feels we're getting close.. but not yet.
> this version with a symlink for the rust lib works, and it's probably what im
> going to commit. fixing the tests requiring a throwaway synapse test instance
> is left for future work.
>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/net/synapse/Makefile,v
> diff -u -r1.82 Makefile
> --- Makefile    31 Jul 2024 16:01:52 -0000      1.82
> +++ Makefile    25 Aug 2024 07:04:41 -0000
> @@ -72,10 +72,20 @@
>  TEST_DEPENDS = ${FULLPKGNAME}:${BUILD_PKGPATH} \
>                 devel/py-mock${MODPY_FLAVOR} \
>                 devel/py-parameterized${MODPY_FLAVOR} \
> +               devel/py-test-forked${MODPY_FLAVOR} \
>                 www/py-jwt${MODPY_FLAVOR}
>  
>  do-configure:
>         @${MODCARGO_configure}
> +
> +MODPY_PYTEST_ARGS =    --forked
> +
> +# some tests fail, but they need a previously running synapse process, not 
> just a database
> +# E synapse.storage.prepare_database.UpgradeDatabaseException: Uninitialised 
> database:
> +# run the main synapse process to prepare the database schema before 
> starting worker processes.
> +# make sure that the rust library is found
> +pre-test:
> +       ln -sf 
> ${WRKSRC}/build/lib.openbsd-${OSREV}-${ARCH}-cpython-${MODPY_MAJORMINOR}/synapse/synapse_rust.abi3.so
>  ${WRKSRC}/synapse/
>  
>  # to generate rust modules.inc:
>  #  make modcargo-gen-crates and modcargo-gen-crates-licenses


I encountered almost exactly the same kind of bug for devel/py-uvloop.
The solution was to move or delete the original sources folder, like so
-
http://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/devel/py-uvloop/Makefile?rev=1.2&content-type=text/x-cvsweb-markup

pre-test:
        cd ${WRKSRC} && test -d uvloop && mv uvloop uvloop-bk || test -d 
uvloop-bk

This was because python tries to find the package to import in the local
folder before it tries to find it in the PYTHONPATH environment vars
locations.

Because the python tests run after the fake target has been completed,
the move should be fine and shouldn't affect the PLIST generation.


> Landry
>

Reply via email to