Django tests in demo projectsΒΆ

Any given code repository usually corresponds to one Python package and has one test suite.

The test suite of a Python package is defined in

In most of our projects this contains a single file tests/ which is if you want the "master file".

A Python package can contain multiple demo projects. A typical test is to run Django's test command in each of them. Something like this (excerpt from the tests/ of The lino-book package):

from lino.utils.pythontest import TestCase

class ProjectsTests(TestCase):

    def test_min1(self):

You know that there is no way to test several Django applications in a single Python process. Every piece of code which imports Django requires the DJANGO_SETTINGS_MODULE environment variable to be set, and it is not allowed to change that variable at runtime. So it is clear that every call to run_django_manage_test is going to spawn subprocess.