Reviving RunAllTests.py on trunk
Porting my fix from gramps40: git diff gramps40^ gramps40 | git apply svn: r22730
This commit is contained in:
		@@ -24,10 +24,12 @@
 | 
			
		||||
import unittest
 | 
			
		||||
import logging
 | 
			
		||||
import sys
 | 
			
		||||
import os
 | 
			
		||||
 | 
			
		||||
log = logging.getLogger('Gramps.Tests.GrampsLogger')
 | 
			
		||||
 | 
			
		||||
sys.path.append('..')
 | 
			
		||||
import gramps.gen.const as const
 | 
			
		||||
const.rootDir = os.path.join(os.path.dirname(__file__), '../../gramps')
 | 
			
		||||
sys.path.append(os.path.join(const.rootDir, 'test'))
 | 
			
		||||
try:
 | 
			
		||||
    from guitest.gtktest import GtkTestCase
 | 
			
		||||
    TestCaseBase = GtkTestCase
 | 
			
		||||
@@ -35,15 +37,10 @@ try:
 | 
			
		||||
except:
 | 
			
		||||
    TestCaseBase = unittest.TestCase
 | 
			
		||||
 | 
			
		||||
sys.path.append('../../src')
 | 
			
		||||
sys.path.append('../../src/GrampsLogger')
 | 
			
		||||
sys.path.append(const.rootDir)
 | 
			
		||||
sys.path.append(os.path.join(const.rootDir, 'GrampsLogger'))
 | 
			
		||||
 | 
			
		||||
import const
 | 
			
		||||
const.rootDir = "../../src"
 | 
			
		||||
 | 
			
		||||
from GrampsLogger import RotateHandler
 | 
			
		||||
 | 
			
		||||
import _ErrorReportAssistant
 | 
			
		||||
from gramps.gui.logger import RotateHandler, _errorreportassistant
 | 
			
		||||
 | 
			
		||||
class ErrorReportAssistantTest(TestCaseBase):
 | 
			
		||||
    """Test the ErrorReportAssistant."""
 | 
			
		||||
@@ -59,7 +56,7 @@ class ErrorReportAssistantTest(TestCaseBase):
 | 
			
		||||
        l.info("info message")
 | 
			
		||||
 | 
			
		||||
        error_detail="Test error"
 | 
			
		||||
        ass = _ErrorReportAssistant.ErrorReportAssistant(error_detail=error_detail,
 | 
			
		||||
        ass = _errorreportassistant.ErrorReportAssistant(error_detail=error_detail,
 | 
			
		||||
                                                               rotate_handler=rh)
 | 
			
		||||
 | 
			
		||||
        assert ass._error_detail == error_detail
 | 
			
		||||
 
 | 
			
		||||
@@ -25,17 +25,15 @@ import unittest
 | 
			
		||||
import logging
 | 
			
		||||
import sys
 | 
			
		||||
from gi.repository import Gtk
 | 
			
		||||
import os
 | 
			
		||||
 | 
			
		||||
log = logging.getLogger('Gramps.Tests.GrampsLogger')
 | 
			
		||||
import gramps.gen.const as const
 | 
			
		||||
const.rootDir = os.path.join(os.path.dirname(__file__), '../../gramps')
 | 
			
		||||
sys.path.append(os.path.join(const.rootDir, 'test'))
 | 
			
		||||
sys.path.append(const.rootDir)
 | 
			
		||||
 | 
			
		||||
sys.path.append('../../src')
 | 
			
		||||
sys.path.append('../../src/GrampsLogger')
 | 
			
		||||
 | 
			
		||||
logger = logging.getLogger('Gramps.Tests.GrampsLogger')
 | 
			
		||||
 | 
			
		||||
import const
 | 
			
		||||
const.rootDir = "../../src"
 | 
			
		||||
 | 
			
		||||
from GrampsLogger import GtkHandler, RotateHandler
 | 
			
		||||
from gramps.gui.logger import RotateHandler, GtkHandler
 | 
			
		||||
 | 
			
		||||
class GtkHandlerTest(unittest.TestCase):
 | 
			
		||||
    """Test the GtkHandler."""
 | 
			
		||||
@@ -64,7 +62,8 @@ class GtkHandlerTest(unittest.TestCase):
 | 
			
		||||
        except:
 | 
			
		||||
            l.error(log_message,exc_info=True)
 | 
			
		||||
 | 
			
		||||
        Gtk.main()
 | 
			
		||||
        while Gtk.events_pending():
 | 
			
		||||
            Gtk.main_iteration()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
 
 | 
			
		||||
@@ -24,12 +24,13 @@
 | 
			
		||||
import unittest
 | 
			
		||||
import logging
 | 
			
		||||
import sys
 | 
			
		||||
import os
 | 
			
		||||
 | 
			
		||||
sys.path.append('../../src/GrampsLogger')
 | 
			
		||||
sys.path.append(os.path.join(os.path.dirname(__file__), '../../gramps/GrampsLogger'))
 | 
			
		||||
 | 
			
		||||
logger = logging.getLogger('Gramps.Tests.GrampsLogger')
 | 
			
		||||
 | 
			
		||||
import _RotateHandler
 | 
			
		||||
from gramps.gui.logger import RotateHandler
 | 
			
		||||
 | 
			
		||||
class RotateHandlerTest(unittest.TestCase):
 | 
			
		||||
    """Test the RotateHandler."""
 | 
			
		||||
@@ -37,7 +38,7 @@ class RotateHandlerTest(unittest.TestCase):
 | 
			
		||||
    def test_buffer_recall(self):
 | 
			
		||||
        """Test that simple recall of messages works."""
 | 
			
		||||
        
 | 
			
		||||
        rh = _RotateHandler.RotateHandler(10)
 | 
			
		||||
        rh = RotateHandler(10)
 | 
			
		||||
        l = logging.getLogger("RotateHandlerTest")
 | 
			
		||||
        l.setLevel(logging.DEBUG)
 | 
			
		||||
        
 | 
			
		||||
@@ -56,7 +57,7 @@ class RotateHandlerTest(unittest.TestCase):
 | 
			
		||||
    def test_buffer_rotation(self):
 | 
			
		||||
        """Test that buffer correctly rolls over when capacity is reached."""
 | 
			
		||||
 | 
			
		||||
        rh = _RotateHandler.RotateHandler(10)
 | 
			
		||||
        rh = RotateHandler(10)
 | 
			
		||||
        l = logging.getLogger("RotateHandlerTest")
 | 
			
		||||
        l.setLevel(logging.DEBUG)
 | 
			
		||||
        
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user