Reviving RunAllTests.py on trunk
Porting my fix from gramps40: git diff gramps40^ gramps40 | git apply svn: r22730
This commit is contained in:
parent
03669acb70
commit
47d397f1ec
@ -31,20 +31,18 @@ import traceback
|
|||||||
import sys
|
import sys
|
||||||
from bsddb import dbshelve, db
|
from bsddb import dbshelve, db
|
||||||
|
|
||||||
sys.path.append('../../src')
|
sys.path.append('../../gramps')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
set()
|
set()
|
||||||
except NameError:
|
except NameError:
|
||||||
from sets import Set as set
|
from sets import Set as set
|
||||||
|
|
||||||
import const
|
import gramps.gen.const
|
||||||
import RelLib
|
|
||||||
|
|
||||||
logger = logging.getLogger('Gramps.GrampsDbBase_Test')
|
logger = logging.getLogger('Gramps.GrampsDbBase_Test')
|
||||||
|
|
||||||
from GrampsDbTestBase import GrampsDbBaseTest
|
from GrampsDbTestBase import GrampsDbBaseTest
|
||||||
import GrampsDb
|
|
||||||
|
|
||||||
class Data(object):
|
class Data(object):
|
||||||
|
|
||||||
|
@ -30,15 +30,14 @@ import time
|
|||||||
import traceback
|
import traceback
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.path.append('../../src')
|
sys.path.append(os.path.join(os.path.dirname(__file__), '../../gramps'))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
set()
|
set()
|
||||||
except NameError:
|
except NameError:
|
||||||
from sets import Set as set
|
from sets import Set as set
|
||||||
|
|
||||||
import const
|
import gramps.gen.lib
|
||||||
import gen.lib
|
|
||||||
|
|
||||||
logger = logging.getLogger('Gramps.GrampsDbBase_Test')
|
logger = logging.getLogger('Gramps.GrampsDbBase_Test')
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ import time
|
|||||||
import traceback
|
import traceback
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.path.append('../src')
|
sys.path.append('../gramps')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
set()
|
set()
|
||||||
@ -38,9 +38,9 @@ except NameError:
|
|||||||
from sets import Set as set
|
from sets import Set as set
|
||||||
|
|
||||||
from gramps.gen.db import DbBsddb
|
from gramps.gen.db import DbBsddb
|
||||||
from cli.clidbman import CLIDbManager
|
from gramps.cli.clidbman import CLIDbManager
|
||||||
import const
|
import gramps.gen.const
|
||||||
import gen.lib
|
import gramps.gen.lib
|
||||||
|
|
||||||
logger = logging.getLogger('Gramps.GrampsDbTestBase')
|
logger = logging.getLogger('Gramps.GrampsDbTestBase')
|
||||||
|
|
||||||
|
@ -24,10 +24,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 gramps.gen.const as const
|
||||||
sys.path.append('..')
|
const.rootDir = os.path.join(os.path.dirname(__file__), '../../gramps')
|
||||||
|
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
|
||||||
@ -35,15 +37,10 @@ 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
|
from gramps.gui.logger import RotateHandler, _errorreportassistant
|
||||||
const.rootDir = "../../src"
|
|
||||||
|
|
||||||
from GrampsLogger import RotateHandler
|
|
||||||
|
|
||||||
import _ErrorReportAssistant
|
|
||||||
|
|
||||||
class ErrorReportAssistantTest(TestCaseBase):
|
class ErrorReportAssistantTest(TestCaseBase):
|
||||||
"""Test the ErrorReportAssistant."""
|
"""Test the ErrorReportAssistant."""
|
||||||
@ -59,7 +56,7 @@ class ErrorReportAssistantTest(TestCaseBase):
|
|||||||
l.info("info message")
|
l.info("info message")
|
||||||
|
|
||||||
error_detail="Test error"
|
error_detail="Test error"
|
||||||
ass = _ErrorReportAssistant.ErrorReportAssistant(error_detail=error_detail,
|
ass = _errorreportassistant.ErrorReportAssistant(error_detail=error_detail,
|
||||||
rotate_handler=rh)
|
rotate_handler=rh)
|
||||||
|
|
||||||
assert ass._error_detail == error_detail
|
assert ass._error_detail == error_detail
|
||||||
|
@ -25,17 +25,15 @@ import unittest
|
|||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
from gi.repository import Gtk
|
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')
|
from gramps.gui.logger import RotateHandler, GtkHandler
|
||||||
sys.path.append('../../src/GrampsLogger')
|
|
||||||
|
|
||||||
logger = logging.getLogger('Gramps.Tests.GrampsLogger')
|
|
||||||
|
|
||||||
import const
|
|
||||||
const.rootDir = "../../src"
|
|
||||||
|
|
||||||
from GrampsLogger import GtkHandler, RotateHandler
|
|
||||||
|
|
||||||
class GtkHandlerTest(unittest.TestCase):
|
class GtkHandlerTest(unittest.TestCase):
|
||||||
"""Test the GtkHandler."""
|
"""Test the GtkHandler."""
|
||||||
@ -64,7 +62,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()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,12 +24,13 @@
|
|||||||
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__), '../../gramps/GrampsLogger'))
|
||||||
|
|
||||||
logger = logging.getLogger('Gramps.Tests.GrampsLogger')
|
logger = logging.getLogger('Gramps.Tests.GrampsLogger')
|
||||||
|
|
||||||
import _RotateHandler
|
from gramps.gui.logger import RotateHandler
|
||||||
|
|
||||||
class RotateHandlerTest(unittest.TestCase):
|
class RotateHandlerTest(unittest.TestCase):
|
||||||
"""Test the RotateHandler."""
|
"""Test the RotateHandler."""
|
||||||
@ -37,7 +38,7 @@ class RotateHandlerTest(unittest.TestCase):
|
|||||||
def test_buffer_recall(self):
|
def test_buffer_recall(self):
|
||||||
"""Test that simple recall of messages works."""
|
"""Test that simple recall of messages works."""
|
||||||
|
|
||||||
rh = _RotateHandler.RotateHandler(10)
|
rh = RotateHandler(10)
|
||||||
l = logging.getLogger("RotateHandlerTest")
|
l = logging.getLogger("RotateHandlerTest")
|
||||||
l.setLevel(logging.DEBUG)
|
l.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
@ -56,7 +57,7 @@ class RotateHandlerTest(unittest.TestCase):
|
|||||||
def test_buffer_rotation(self):
|
def test_buffer_rotation(self):
|
||||||
"""Test that buffer correctly rolls over when capacity is reached."""
|
"""Test that buffer correctly rolls over when capacity is reached."""
|
||||||
|
|
||||||
rh = _RotateHandler.RotateHandler(10)
|
rh = RotateHandler(10)
|
||||||
l = logging.getLogger("RotateHandlerTest")
|
l = logging.getLogger("RotateHandlerTest")
|
||||||
l.setLevel(logging.DEBUG)
|
l.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ from bsddb import dbshelve, db
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.path.append('../src')
|
sys.path.append('../gramps')
|
||||||
import const
|
import const
|
||||||
|
|
||||||
env_name = os.path.expanduser(const.bsddbenv_dir)
|
env_name = os.path.expanduser(const.bsddbenv_dir)
|
||||||
|
@ -26,7 +26,7 @@ import tempfile
|
|||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.path.append('../src')
|
sys.path.append('../gramps')
|
||||||
|
|
||||||
import GrampsDb
|
import GrampsDb
|
||||||
import const
|
import const
|
||||||
|
@ -1,57 +0,0 @@
|
|||||||
#
|
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
|
||||||
#
|
|
||||||
# Copyright (C) 2000-2007 Donald N. Allingham
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
|
|
||||||
# test/RelLib/RelLib_Test.py
|
|
||||||
# $Id$
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
import logging
|
|
||||||
import os
|
|
||||||
import tempfile
|
|
||||||
import shutil
|
|
||||||
import time
|
|
||||||
import traceback
|
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
|
||||||
set()
|
|
||||||
except NameError:
|
|
||||||
from sets import Set as set
|
|
||||||
|
|
||||||
|
|
||||||
import RelLib
|
|
||||||
|
|
||||||
logger = logging.getLogger('Gramps.RelLib_Test')
|
|
||||||
|
|
||||||
|
|
||||||
class PrimaryObjectTest (unittest.TestCase):
|
|
||||||
"""Test methods on the PrimaryObject class"""
|
|
||||||
|
|
||||||
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def testSuite():
|
|
||||||
suite = unittest.makeSuite(PrimaryObjectTest,'test')
|
|
||||||
return suite
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.TextTestRunner().run(testSuite())
|
|
@ -33,7 +33,9 @@ import sys
|
|||||||
import unittest
|
import unittest
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
|
||||||
sys.path.append('../src')
|
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||||
|
os.environ['GRAMPS_RESOURCES'] = os.path.join(
|
||||||
|
os.path.dirname(os.path.abspath(__file__)), '..')
|
||||||
|
|
||||||
def make_parser():
|
def make_parser():
|
||||||
usage = "usage: %prog [options]"
|
usage = "usage: %prog [options]"
|
||||||
@ -48,7 +50,7 @@ def make_parser():
|
|||||||
def getTestSuites():
|
def getTestSuites():
|
||||||
# Sorry about this line, but it is the easiest way of doing it.
|
# Sorry about this line, but it is the easiest way of doing it.
|
||||||
# It just walks the filetree from '.' downwards and returns
|
# It just walks the filetree from '.' downwards and returns
|
||||||
# a tuple per directory of (dirpatch,filelist) if the directory
|
# a tuple per directory of (dirpath,filelist) if the directory
|
||||||
# contains any test files.
|
# contains any test files.
|
||||||
|
|
||||||
paths = [(f[0],f[2]) for f in os.walk('.') \
|
paths = [(f[0],f[2]) for f in os.walk('.') \
|
||||||
@ -62,7 +64,7 @@ def getTestSuites():
|
|||||||
perf_suites = []
|
perf_suites = []
|
||||||
for module in test_modules:
|
for module in test_modules:
|
||||||
if module[-8:] != "_Test.py":
|
if module[-8:] != "_Test.py":
|
||||||
break
|
continue
|
||||||
mod = __import__(module[:-3])
|
mod = __import__(module[:-3])
|
||||||
test_suites.append(mod.testSuite())
|
test_suites.append(mod.testSuite())
|
||||||
try:
|
try:
|
||||||
@ -79,7 +81,6 @@ def perfTests():
|
|||||||
return unittest.TestSuite(getTestSuites()[1])
|
return unittest.TestSuite(getTestSuites()[1])
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
console = logging.StreamHandler()
|
console = logging.StreamHandler()
|
||||||
console.setLevel(logging.INFO)
|
console.setLevel(logging.INFO)
|
||||||
console.setFormatter(logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s'))
|
console.setFormatter(logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s'))
|
||||||
@ -106,8 +107,5 @@ if __name__ == '__main__':
|
|||||||
logger.setLevel(logging.ERROR)
|
logger.setLevel(logging.ERROR)
|
||||||
console.setLevel(logging.ERROR)
|
console.setLevel(logging.ERROR)
|
||||||
|
|
||||||
|
tests = perfTests() if options.performance else allTheTests()
|
||||||
if options.performance:
|
unittest.TextTestRunner(verbosity=options.verbose_level).run(tests)
|
||||||
unittest.TextTestRunner(verbosity=options.verbose_level).run(perfTests())
|
|
||||||
else:
|
|
||||||
unittest.TextTestRunner(verbosity=options.verbose_level).run(allTheTests())
|
|
||||||
|
Loading…
Reference in New Issue
Block a user