Thursday, July 30, 2015

Optimizing Lino Noi

I understood how to continue on #343 (Änderungswünsche Juli 2015). This ticket is “just” a request for a cost estimation for a wish list with a dozen items. I already converted them into tickets in our internal Lino Noi database. Some of these wishes are small optimizations and will be satisfied as part of the maintenance contract. We don’t need any estimation for these, they just go to our Some other tickets should become separate (small) projects. And then Gerd will be able to see them in the service report. It needs just a small change to Lino Noi in order to make this possible: #379 (Add planned_time and ticket_state to Service Report)

I also understood why Lino was still failing on Travis CI (see error message yesterday). It was about lino.projects.polly.settings: doctests must inherit from demo. I could reproduce this error on my machine after deleting my LINO_CACHE_ROOT.

Getting Lino to pass on Travis CI

And Lino is still failing on Travis. We get yet another error message:

File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/test/", line 144, in run_tests
  suite = self.build_suite(test_labels, extra_tests)
File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/test/", line 93, in build_suite
  tests =, **kwargs)
File "/opt/python/2.7.9/lib/python2.7/unittest/", line 206, in discover
  tests = list(self._find_tests(start_dir, pattern))
File "/opt/python/2.7.9/lib/python2.7/unittest/", line 267, in _find_tests

  raise ImportError(msg % (mod_name, module_dir, expected_dir))

ImportError: 'tests' module incorrectly imported from '/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/lino/projects/belref'.
Expected '/home/travis/build/lsaffre/lino/lino/projects/belref'.
Is this module globally installed?

Graham Klyne reported a similar problem in Django test runner fails in virtualenv on Ubuntu (September 2014). Yes, this seems to be a bug in Python’s test discovery which occurs when it is called with an explicit “.” as start directory. And Django’s test command does exactly this. It seems that this bug did not yet exist in Python 2.7.4 (the Python 2.7 I have installed). But Travis are using Python 2.7.9.

How to get Python 2.7.9 on an Ubuntu 14.04? Seems not trivial:

But then an idea to maybe work around it: a little change in lino.utils.pythontest.TestCase.run_django_manage_test.

  • Job 387: AssertionError: python test –noinput –failfast ({‘cwd’: ‘lino/projects/belref’}) returned 1:

  • Job 389: AssertionError: python test /home/travis/build/lsaffre/lino/lino/projects/belref –noinput –failfast ({‘cwd’: ‘lino/projects/belref’}) returned 1:

  • Job 390: AssertionError: python test /home/travis/build/lsaffre/lino/lino/projects/belref –noinput –failfast ({‘cwd’: ‘lino/projects/belref’}) returned

So unfortunately the problem persists. The unittest discoverer asks to import a file in a directory under /home/travis/build/ and then complains because the imported module’s path is in a directory below /home/travis/virtualenv/python2.7.9/.

And neither abspath nor realpath can help here because my specified working directory is the real path. It is the imported module’s path that should get canonized.


  • Added printed to the detail layout of courses.Enrolments

  • The ClientDetail.newcomers_left panel is now available also for NewcomersOperator mainly because otherwise the AvailableCoachesByClient panel is not high enough.

  • New method lino.modlib.beid.mixins.Beidcardholder.make_demo_picture() was needed because after clearing my LINO_CACHE_ROOT the missing picture file caused create_excerpt to fail.