Monday, February 15, 2021

In demo project lydia, “pm test tests.test_ipdict” passed, but “pm test” failed. Which indicated that somehow depends on the other test cases. This caused an avalanche of changes in the test suite. I also learned a few things. Lino has a new django-admin command demotest.

The Django docs warns “If your tests rely on database access such as creating or querying models, be sure to create your test classes as subclasses of django.test.TestCase rather than unittest.TestCase.” I thought that when I don’t use django.test.TestCase, my test will use the database defined in the file (i.e. the prepared demo data).

So it seems that the Django tests in the demo projects (= run using test from a demo project directory, not using inv test from the repository root) actually never use the database that has been prepared with pm prep. I thought that the WebIndexTestCase does this. But seems that I was wrong.

The new django-admin command demotest replaces what has previously been done by and I removed these files from all projects. It is now being called in the, which I added to some repositories. E.g. we now also have such a file in welfare, amici, algus, mentori and others.

The test suite in welfare and amici did not run test in their demo projects. Seems that they have been sleeping for quite long. Now they are back But two of them were using lino.api.doctest.check_callback_dialog(), and I didn’t yet manage to get this back to work. I marked them as skipped.

The new demotest command also unveiled a series of deprecation warnings, which I fixed. I had not seen them before because usually they are disabled.

I rediscovered two tested docs that hadn’t yet been moved to the docs tree in book: Local customizations to the user permissions and lookup_or_create and the auto_create signal.