Zim

Fail to test zim in a chroot

Asked by Robin Lee

I try to package zim 0.43 in a chroot using mock which is a Fedora tool.
When running ./test.py in the packaging process, it failed immediately and showed:

+ ./test.py
['tests.errors', 'tests.parsing', 'tests.fs', 'tests.config', 'tests.applications', 'tests.formats', 'tests.templates', 'tests.stores', 'tests.index', 'tests.notebook', 'tests.history', 'tests.plugins', 'tests.export', 'tests.www', 'tests.search', 'tests.pageview', 'tests.calendar', 'tests.printtobrowser', 'tests.versioncontrol', 'tests.equationeditor', 'tests.diagrameditor']
Traceback (most recent call last):
  File "./test.py", line 315, in <module>
    main()
  File "./test.py", line 169, in main
    test = loader.loadTestsFromName(name)
  File "/usr/lib/python2.6/unittest.py", line 584, in loadTestsFromName
    parent, obj = obj, getattr(obj, part)
AttributeError: 'module' object has no attribute 'applications'

The list after '+ ./test.py' is just the value of 'modules' in line 168 in test.py.

But when I test it in my own environment, it will start to run successfully, no matter whether in packing process or I run ./test.py directly.

So I guess this may not be a bug in the program.
But what's the cause? Do I miss some build requirements which you didn't list in README.txt?

Question information

Language:
English Edit question
Status:
Solved
For:
Zim Edit question
Assignee:
No assignee Edit question
Solved by:
Robin Lee
Solved:
Last query:
Last reply:
Revision history for this message
Jaap Karssenberg (jaap.karssenberg) said :
#1

Not sure. The test framework assumes a shell environment in the local
source dir - so all patch and module imports are relative to the
source tree.

Not sure what environment you have when you call test.py - are the
files still in the same layout as in the source tree ?

Revision history for this message
Robin Lee (cheeselee) said :
#2

I may have found the answer that ./test.py, or at least some of the tests, must run in a graphical environment. I run one of the test directly within a pure console environment and it shows:

$ ./test.py -D applications
Traceback (most recent call last):
  File "./test.py", line 315, in <module>
    main()
  File "./test.py", line 169, in main
    test = loader.loadTestsFromName(name)
  File "/usr/lib/python2.6/unittest.py", line 576, in loadTestsFromName
    module = __import__('.'.join(parts_copy))
  File "/builddir/build/BUILD/zim-0.43/tests/applications.py", line 11, in <module>
    from zim.gui.applications import *
  File "/builddir/build/BUILD/zim-0.43/zim/gui/__init__.py", line 30, in <module>
    import gtk
  File "/usr/lib/python2.6/site-packages/gtk-2.0/gtk/__init__.py", line 64, in <module>
    _init()
  File "/usr/lib/python2.6/site-packages/gtk-2.0/gtk/__init__.py", line 52, in _init
    _gtk.init_check()
RuntimeError: could not open display

The same will be issued if I have installed pygtk in the chroot environment.