selftest crashed if qbzr installed without pyqt4

Bug #333892 reported by Alexander Belchenko
4
Affects Status Importance Assigned to Milestone
QBzr
Fix Released
High
Alexander Belchenko

Bug Description

vila reported in IRC about qbzr bug when he tries to run selftest with qbzr installed without pyqt4.

[17:39] <vila> bialix: by the way, qbzr still blows out when I try to run selftest with python-2.6 (for which I don't have pyqt4)
[17:39] <bialix> file a bug please
[17:40] <bialix> vila: IIRC I dont try to fix selftest w/o PyQt4 yet
[17:40] <vila> bialix: I did and I thought you fixed pretty quickly, only to discover later that the problem was still there
[17:40] <bialix> vila: this is different problem
[17:41] <bialix> I've fixed bug-url command, but you now talks about selftest
[17:41] <bialix> why you run selftest for qbzr if you don;t have qt?
[17:42] <vila> I run selftest and that includes qbzr because it's installed
[17:43] <vila> the problem is that qbzr *aborts* at load time instead of raising some import error or something that disables it without aborting the current command

vila has provided quick fix, but we have to fix it properly. Quick fix is to catch ImportError in test_suite()

=== modified file '__init__.py'
--- __init__.py 2009-02-13 00:42:16 +0000
+++ __init__.py 2009-02-24 15:46:27 +0000
@@ -104,4 +104,8 @@

 def load_tests(basic_tests, module, loader):
     from bzrlib.plugins.qbzr.lib.tests import load_tests
- return load_tests(basic_tests, module, loader)
+ try:
+ suite = load_tests(basic_tests, module, loader)
+ except ImportError:
+ return basic_tests
+ return suite

Related branches

Changed in qbzr:
importance: Undecided → High
milestone: none → 0.9.9
status: New → Confirmed
Revision history for this message
Alexander Belchenko (bialix) wrote :

I have fix that skips only those test modules where it can't import PyQt4. Unfortunately lazy import cannot be used in test modules.

Vincent, how about this warnings during selftest startup when there is no PyQt4, does it acceptable to you?

C:\work\Bazaar\mydev.packs\bzr.dev>py24 bzr selftest -s bp.qbzr
testing: C:/work/Bazaar/mydev.packs/bzr.dev/bzr
   C:\work\Bazaar\mydev.packs\bzr.dev\bzrlib (1.13dev python2.4.4)

QBzr: skip module bzrlib.plugins.qbzr.lib.tests.test_logmodel because PyQt4 is not installed
QBzr: skip module bzrlib.plugins.qbzr.lib.tests.test_spellcheck because PyQt4 is not installed
QBzr: skip module bzrlib.plugins.qbzr.lib.tests.test_util because PyQt4 is not installed

----------------------------------------------------------------------
Ran 13 tests in 0.797s

OK
tests passed

Changed in qbzr:
assignee: nobody → bialix
status: Confirmed → In Progress
Revision history for this message
Vincent Ladeuil (vila) wrote :

As long as it fixed the bug, I'm fine with it !

That being said, your messages looks a lot like what "raise tests.UnavailableFeature('PyQt4 is not installed')" will show in selftest context, I don't know if you used that in your fix... But doing so will summarize the number of tests skipped like:

Missing feature 'PyQt4 is not installed' skipped NNN tests.

And don't be so mean with ubottu, it's a brave bot, but it doesn't have to nag me about your comments since launchpad (another team of brave bots :) does that very well as I'm automatically subscribed to bugs I reported :)

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

fix in the trunk.

Changed in qbzr:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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