Download raw body.
net/synapse: fix tests
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:
collected 0 items / 273 errors
==================================== ERRORS
====================================
___________________ ERROR collecting tests/api/test_auth.py
____________________
ImportError while importing test module
'/usr/obj/ports/synapse-1.112.0/synapse-1.112.0/tests/api/test_auth.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/lib/python3.11/importlib/__init__.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/__init__.py:24: in <module>
from synapse.util.patch_inline_callbacks import do_patch
synapse/__init__.py:32: in <module>
from synapse.util.rust import check_rust_lib_up_to_date
synapse/util/rust.py:27: in <module>
from synapse.synapse_rust import get_rust_file_digest
E ImportError: cannot import name 'get_rust_file_digest' from 'synapse.synapse_rust' (unknown location)
>
> > > On 6/10/24 4:01 PM, Kirill A. Korinsky wrote:
> > > > ports@
> > > >
> > > > I discovered that make test for net/synapse doesn't work, all tests fail.
> > > >
> > > > Thus, tests seems to be leaked and it consumes near 8G of RAM before it was
> > > > killed due to hit the hard limit on my system.
> > > >
> > > > To avoid that I had added pytest-forked to run each test in dedicated
> > > > process that allows to limit memory consumption to 200-300 mb.
> > > >
> > >
> > > That's OK for me, but if you find a way so that it passes psql tests
> > > too, like Landry@ suggested, that would be nice.
> > >
> >
> > diff --git net/synapse/Makefile net/synapse/Makefile
> > index 5af1b855170..6554cad5b50 100644
> > --- net/synapse/Makefile
> > +++ net/synapse/Makefile
> > @@ -72,11 +72,19 @@ RUN_DEPENDS += www/py-requests${MODPY_FLAVOR}
> > 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 tests/
> > +MODPY_TEST_DIR = ${WRKDIR}
> > +
> > +pre-test:
> > + @rm -fr ${WRKDIR}/tests
> > + @cp -r ${WRKSRC}/tests ${WRKDIR}/
> > +
> > # to generate rust modules.inc:
> > # make modcargo-gen-crates and modcargo-gen-crates-licenses
> > .include "modules.inc"
> >
> >
> > --
> > wbr, Kirill
>
net/synapse: fix tests