Download raw body.
net/synapse: fix tests
Le Sun, Aug 25, 2024 at 03:30:56AM -0400, A Tammy a écrit :
>
> 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 <landry@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.
yeah, i also figured that out after finding how nix runs the tests in
their synapse package, they rm -Rf synapse before starting tests.
interestingly, i also realized that upstream doesn't run tests via
pytest, but via twisted.trial, which might work around the "needs a
running instance of synapse first" issue.
currently trying with:
# this symlink makes sure that the rust library is found, since by default the source is used to run the tests
pre-test:
ln -sf ${WRKSRC}/build/lib.openbsd-${OSREV}-${ARCH}-cpython-${MODPY_MAJORMINOR}/synapse/synapse_rust.abi3.so ${WRKSRC}/synapse/
do-test:
cd ${MODPY_TEST_DIR} && ${SETENV} ${ALL_TEST_ENV} ${MODPY_BIN} -m twisted.trial tests
this produces a more verbose output with all tests names printed, but maybe
more tests succeed.
net/synapse: fix tests