test_treewidget.TestTreeModel.test_model_working_tree fatal error

Bug #477823 reported by Alexander Belchenko
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
QBzr
Fix Released
High
Gary van der Merwe

Bug Description

When I run selftest on Windows I'm get error dialog window with the following text:

---------------------------
Microsoft Visual C++ Runtime Library
---------------------------
Runtime Error!

Program: C:\Program Files\Bazaar\bzr.exe

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

---------------------------
ОК
---------------------------

Log in the console (for bzr selftest -s bp.qbzr -v):

bzrlib.plugins.qbzr.lib.tests.test_treewidget.TestModelItemData.test_sort_key_one_dir OK 14ms
bzrlib.plugins.qbzr.lib.tests.test_treewidget.TestModelItemData.test_sort_key_sub_dirs OK 0ms
bzrlib.plugins.qbzr.lib.tests.test_treewidget.TestTreeModel.test_model_working_tree QPixmap: Must construct a QApplication before a QPaintDevice

I'm disable this tests for now, because it totaly break test suite for me.

Related branches

Changed in qbzr:
status: New → Confirmed
importance: Undecided → High
assignee: nobody → Gary van der Merwe (garyvdm)
Revision history for this message
John A Meinel (jameinel) wrote : Re: [Bug 477823] [NEW] test_treewidget.TestTreeModel.test_model_working_tree fatal error

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Alexander Belchenko wrote:
> Public bug reported:
>
> When I run selftest on Windows I'm get error dialog window with the
> following text:
>
> ---------------------------
> Microsoft Visual C++ Runtime Library
> ---------------------------
> Runtime Error!
>
> Program: C:\Program Files\Bazaar\bzr.exe
>
>
> This application has requested the Runtime to terminate it in an unusual way.
> Please contact the application's support team for more information.
>
>
> ---------------------------
> ОК
> ---------------------------
>
>
> Log in the console (for bzr selftest -s bp.qbzr -v):
>
> bzrlib.plugins.qbzr.lib.tests.test_treewidget.TestModelItemData.test_sort_key_one_dir OK 14ms
> bzrlib.plugins.qbzr.lib.tests.test_treewidget.TestModelItemData.test_sort_key_sub_dirs OK 0ms
...
    QPixmap: Must construct a QApplication before a QPaintDevice

I think this is the core of the problem. QApplication is where Qt does
all of its memory management, etc. There must be a single QApplication
running when you want to do things with Qt objects.

In my qt based test suites, I created a TestCase like:

import unittest

class TestCaseWithQt(unittest.TestCase):
  the_app = None

  def setUp(self):
    super(TestCaseWithQt, self).setUp()
    if TestCaseWithQt.the_app is None:
      TestCaseWithQt.the_app = QtCore.QApplication() # pass args?

Basically, you just ensure that a singleton QApplication is running. I
would think you could do something similar, or possibly change it around
a bit and do that in 'load_tests'.

def load_tests(...):
  global the_app
  if the_app is None:
    the_app = QtCore.QApplication()
    # ensure an App before running the tests.

This isn't quite as nice, as it will still build the QApplication even
if someone later filters out all qt tests ('bzr selftest -x qbzr'). But
it is probably still a reasonable way to do it.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkr2BR0ACgkQJdeBCYSNAAPD7gCfbYNkjspWuhZ2lTPl2PNRfX3b
Nk4AoMm1+odzLWT9QGcNajX4wWP+lHxn
=NEgb
-----END PGP SIGNATURE-----

Changed in qbzr:
milestone: none → 0.16
status: Confirmed → 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.