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:
		@@ -1,10 +1,12 @@
 | 
			
		||||
import unittest
 | 
			
		||||
import logging
 | 
			
		||||
import sys
 | 
			
		||||
import os
 | 
			
		||||
 | 
			
		||||
log = logging.getLogger('Gramps.Tests.GrampsLogger')
 | 
			
		||||
 | 
			
		||||
sys.path.append('..')
 | 
			
		||||
import const
 | 
			
		||||
const.rootDir = os.path.join(os.path.dirname(__file__), '../../src')
 | 
			
		||||
sys.path.append(os.path.join(const.rootDir, 'test'))
 | 
			
		||||
try:
 | 
			
		||||
    from guitest.gtktest import GtkTestCase
 | 
			
		||||
    TestCaseBase = GtkTestCase
 | 
			
		||||
@@ -12,11 +14,8 @@ try:
 | 
			
		||||
except:
 | 
			
		||||
    TestCaseBase = unittest.TestCase
 | 
			
		||||
 | 
			
		||||
sys.path.append('../../src')
 | 
			
		||||
sys.path.append('../../src/GrampsLogger')
 | 
			
		||||
 | 
			
		||||
import const
 | 
			
		||||
const.rootDir = "../../src"
 | 
			
		||||
sys.path.append(const.rootDir)
 | 
			
		||||
sys.path.append(os.path.join(const.rootDir, 'GrampsLogger'))
 | 
			
		||||
 | 
			
		||||
from GrampsLogger import RotateHandler
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2,15 +2,13 @@ import unittest
 | 
			
		||||
import logging
 | 
			
		||||
import sys
 | 
			
		||||
import gtk
 | 
			
		||||
import os
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
sys.path.append('../../src')
 | 
			
		||||
sys.path.append('../../src/GrampsLogger')
 | 
			
		||||
 | 
			
		||||
logger = logging.getLogger('Gramps.Tests.GrampsLogger')
 | 
			
		||||
 | 
			
		||||
log = logging.getLogger('Gramps.Tests.GrampsLogger')
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
@@ -41,7 +39,8 @@ class GtkHandlerTest(unittest.TestCase):
 | 
			
		||||
        except:
 | 
			
		||||
            l.error(log_message,exc_info=True)
 | 
			
		||||
 | 
			
		||||
        gtk.main()
 | 
			
		||||
        while gtk.events_pending():
 | 
			
		||||
            gtk.main_iteration()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,9 @@
 | 
			
		||||
import unittest
 | 
			
		||||
import logging
 | 
			
		||||
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')
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user