On Mon, Sep 07, 2020 at 02:57:20PM -0400, Aisha Tammy wrote:

> One thing that I am struggling with is to find documentation on doing
> testing of ports using pytest and python unittests.

> I know of MODPY_PYTEST and then the *-test blocks but MODPY_PYTEST is
> not always enough/ doesn't set the right environment.

> I want to be able to get the tests running for the modules I'm
> importing and updating to latest.

I appreciate you wanting to get the tests working. :D

There are numerous little things that can be tweaked to get MODPY_PYTEST
working correctly. Some ports put a "lib" directory in the WRKDIR that
has a duplicate of all the files in the test/tests directory. pytest doesn't
especially care for that. :) In such cases, specifying MODPY_PYTEST_ARGS
with the name of the test directory helps restrict it there.

The other common one is setting the PYTHONPATH in TEST_ENV to include the
built-but-not-installed module for testing. This helps avoid having a
port depend on itself for testing. If you have problems getting tests going,
feel free to drop me a note. I've picked up all these little tricks and 
tweaks, but I tend not to remember them all unless I am fixing a python
port. :)

--Kurt

Reply via email to