6938: sys.path broken in unit tests under test/

While at it, also fixed GtkHandler_Test -
changed
-        gtk.main()
+        while gtk.events_pending():
+            gtk.main_iteration()
so that the test isn't stuck when done.

Note that this test currently is marked as failed
as its purpose is to pop up an error dialog.

svn: r22724
This commit is contained in:
Vassilii Khachaturov 2013-07-23 07:20:11 +00:00
parent c128986c6f
commit 96ce483828
3 changed files with 15 additions and 16 deletions

View File

@ -1,10 +1,12 @@
import unittest import unittest
import logging import logging
import sys import sys
import os
log = logging.getLogger('Gramps.Tests.GrampsLogger') log = logging.getLogger('Gramps.Tests.GrampsLogger')
import const
sys.path.append('..') const.rootDir = os.path.join(os.path.dirname(__file__), '../../src')
sys.path.append(os.path.join(const.rootDir, 'test'))
try: try:
from guitest.gtktest import GtkTestCase from guitest.gtktest import GtkTestCase
TestCaseBase = GtkTestCase TestCaseBase = GtkTestCase
@ -12,11 +14,8 @@ try:
except: except:
TestCaseBase = unittest.TestCase TestCaseBase = unittest.TestCase
sys.path.append('../../src') sys.path.append(const.rootDir)
sys.path.append('../../src/GrampsLogger') sys.path.append(os.path.join(const.rootDir, 'GrampsLogger'))
import const
const.rootDir = "../../src"
from GrampsLogger import RotateHandler from GrampsLogger import RotateHandler

View File

@ -2,15 +2,13 @@ import unittest
import logging import logging
import sys import sys
import gtk import gtk
import os
log = logging.getLogger('Gramps.Tests.GrampsLogger')
sys.path.append('../../src')
sys.path.append('../../src/GrampsLogger')
logger = logging.getLogger('Gramps.Tests.GrampsLogger')
import const import const
const.rootDir = "../../src" const.rootDir = os.path.join(os.path.dirname(__file__), '../../src')
sys.path.append(os.path.join(const.rootDir, 'test'))
sys.path.append(const.rootDir)
from GrampsLogger import GtkHandler, RotateHandler from GrampsLogger import GtkHandler, RotateHandler
@ -41,7 +39,8 @@ class GtkHandlerTest(unittest.TestCase):
except: except:
l.error(log_message,exc_info=True) l.error(log_message,exc_info=True)
gtk.main() while gtk.events_pending():
gtk.main_iteration()

View File

@ -1,8 +1,9 @@
import unittest import unittest
import logging import logging
import sys import sys
import os
sys.path.append('../../src/GrampsLogger') sys.path.append(os.path.join(os.path.dirname(__file__), '../../src/GrampsLogger'))
logger = logging.getLogger('Gramps.Tests.GrampsLogger') logger = logging.getLogger('Gramps.Tests.GrampsLogger')