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/
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Alexander Belchenko wrote: ------- ------- ------ ------- ------- ------ bzr.exe ------- ------- ------ ------- ------- ------ plugins. qbzr.lib. tests.test_ treewidget. TestModelItemDa ta.test_ sort_key_ one_dir OK 14ms plugins. qbzr.lib. tests.test_ treewidget. TestModelItemDa ta.test_ sort_key_ sub_dirs OK 0ms
> 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\
>
>
> 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.
> bzrlib.
...
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): TestCaseWithQt, self).setUp() the_app is None: ithQt.the_ app = QtCore. QApplication( ) # pass args?
super(
if TestCaseWithQt.
TestCaseW
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(...): QApplication( )
global the_app
if the_app is None:
the_app = QtCore.
# 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 enigmail. mozdev. org/
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAkr 2BR0ACgkQJdeBCY SNAAPD7gCfbYNkj spWuhZ2lTPl2PNR fX3b odzLWT9QGcNajX4 wWP+lHxn
Nk4AoMm1+
=NEgb
-----END PGP SIGNATURE-----