explorer selftests should make pyqt4 a soft dependency

Bug #488681 reported by Martin Pool
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Bazaar Explorer
Fix Released
High
Alexander Belchenko

Bug Description

If the explorer plugin is present but pyqt4 is not installed, you can't run the bzr test suite at all, because explorer has an unguarded import statement. I think there is a mechanism by which it can turn this into just skipping the tests?

2.694 Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 842, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 1037, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 654, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.6/dist-packages/bzrlib/builtins.py", line 3489, in run
    result = selftest(**selftest_kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/tests/__init__.py", line 3243, in selftest
    suite = test_suite(keep_only, starting_with)
  File "/usr/lib/python2.6/dist-packages/bzrlib/tests/__init__.py", line 3688, in test_suite
    plugin_suite = plugin.load_plugin_tests(loader)
  File "/usr/lib/python2.6/dist-packages/bzrlib/plugin.py", line 383, in load_plugin_tests
    return loader.loadTestsFromModule(self.module)
  File "/usr/lib/python2.6/dist-packages/bzrlib/tests/TestUtil.py", line 129, in loadTestsFromModule
    return load_tests(basic_tests, module, self)
  File "/home/mbp/.bazaar/plugins/explorer/__init__.py", line 43, in load_tests
    return load_tests(basic_tests, module, loader)
  File "/home/mbp/.bazaar/plugins/explorer/tests/__init__.py", line 86, in load_tests
    suite.addTests(loader.loadTestsFromModuleNames(mod_names))
  File "/usr/lib/python2.6/dist-packages/bzrlib/tests/TestUtil.py", line 92, in loadTestsFromModuleNames
    result.addTests(self.loadTestsFromModuleName(name))
  File "/usr/lib/python2.6/dist-packages/bzrlib/tests/TestUtil.py", line 97, in loadTestsFromModuleName
    module = _load_module_by_name(name)
  File "/usr/lib/python2.6/dist-packages/bzrlib/tests/TestUtil.py", line 166, in _load_module_by_name
    module = __import__(mod_name)
  File "/home/mbp/.bazaar/plugins/explorer/tests/test_test_suite.py", line 19, in <module>
    from PyQt4 import QtCore, QtGui
ImportError: No module named PyQt4

Related branches

Revision history for this message
Alexander Belchenko (bialix) wrote :

We have similar guard code in qbzr for the same reasons. Just need to copy-paste the approach, perhaps.

Changed in bzr-explorer:
importance: Undecided → High
status: New → Confirmed
Revision history for this message
Ian Clatworthy (ian-clatworthy) wrote :

John,

Could you take a look at this please?

Changed in bzr-explorer:
assignee: nobody → John A Meinel (jameinel)
Revision history for this message
Alexander Belchenko (bialix) wrote :

To be honest bzr-svn is also has similar problem: it blocks running selftest if there is no subvertpy library installed:

C:\work\Bazaar\bzr-2a\bzr.dev>py26 bzr selftest --list-only > NUL
bzr: ERROR: No module named subvertpy
You may need to install this Python library separately.
bzr: warning: some compiled extensions could not be loaded; see <https://answers.launchpad.net/bzr/+faq/703>

Why Explorer is any worse then?

Changed in bzr-explorer:
assignee: John A Meinel (jameinel) → Alexander Belchenko (bialix)
status: Confirmed → Fix Committed
Changed in bzr-explorer:
status: Fix Committed → Fix Released
milestone: none → 1.0.0rc1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.