diff --git a/ChangeLog b/ChangeLog index a1ea89799..ccca1717d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-12-07 Douglas S. Blank + * src/PluginUtils/Makefile.am: Missing _PluginsWindows.py + * po/test: new unittest dir + * po/test/po_test.py: new unittest suite for POTFILES + and Makefiles + * po/POTFILES.in: Missing CalculateEstimatedDates.py + 2007-12-06 Douglas S. Blank * src/PluginUtils/_MenuOptions.py: Fixed boolean option double label diff --git a/po/POTFILES.in b/po/POTFILES.in index 2a6fb4624..47fc8de60 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -256,6 +256,7 @@ src/plugins/siblings.py src/plugins/AncestorChart.py src/plugins/AncestorReport.py src/plugins/BookReport.py +src/plugins/CalculateEstimatedDates.py src/plugins/Calendar.py src/plugins/ChangeNames.py src/plugins/ChangeTypes.py diff --git a/po/test/po_test.py b/po/test/po_test.py new file mode 100644 index 000000000..981294a58 --- /dev/null +++ b/po/test/po_test.py @@ -0,0 +1,126 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 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 +# + +# $Id: $ + +""" Unittest for testing POTFILES.in and Makefile contents """ + +__author__ = "Douglas S. Blank " +__revision__ = "$Revision: $" + +import unittest +import os +import glob +from test import test_util +test_util.path_append_parent() + +excluded_files = ["src/DataViews/_MapView.py", + "src/plugins/PHPGedViewConnector.py", + "src/plugins/phpgedview.glade", + "src/plugins/Ancestors.py", + "src/plugins/DesGraph.py", + "src/plugins/FtmStyleAncestors.py", + "src/plugins/FtmStyleDescendants.py", + "src/plugins/IndivSummary.py", + "src/date_test.py", + "src/plugins/CmdRef.py", + "src/plugins/DumpGenderStats.py", + "src/plugins/Eval.py", + "src/plugins/Leak.py", + "src/plugins/TestcaseGenerator.py" + ] + +def get_potfile(filename): + fp = open(filename, "r") + retvals = [] + for line in fp: + if line and line[0] != "#": + retvals.append(line.strip()) + fp.close() + return retvals + +class TestPOT(unittest.TestCase): + potfiles = get_potfile("../POTFILES.in") + count = 1 + def __init__(self, method_name, dir, file, search): + method_name = method_name % self.count + TestPOT.count += 1 + self.__dict__[method_name] = lambda: self.helper(dir, file, search) + unittest.TestCase.__init__(self, method_name) + + def helper(self, dir, file, search): + realpath = (dir + "/" + file) + pathfile = realpath[3:] + if os.path.exists(realpath): + fp = open(realpath, "r") + lines = fp.read() + fp.close() + if search in lines: + self.assertFalse(pathfile[3:] not in excluded_files and + pathfile[3:] not in self.potfiles, + "'%s' is not in POTFILES.in" % (pathfile[3:],)) + else: + self.assertTrue(True, "'%s' doesn't contain '%s'" % + (file, search)) + else: + self.assertTrue(True, "'%s' doesn't exist" % file) + +class TestMake(unittest.TestCase): + count = 1 + def __init__(self, method_name, dir, file): + method_name = method_name % self.count + TestMake.count += 1 + self.__dict__[method_name] = lambda: self.helper(dir, file) + unittest.TestCase.__init__(self, method_name) + + def helper(self, dir, file): + realpath = (dir + "/" + file) + pathfile = realpath[3:] + path, filename = realpath.rsplit("/", 1) + makefile = path + "/Makefile.in" + if pathfile[3:] in excluded_files: + self.assertTrue(True, "exclude '%s'" % pathfile) + elif os.path.exists(makefile): + fp = open(makefile, "r") + lines = fp.read() + fp.close() + self.assertTrue(filename in lines, "'%s' not in %s/Makefile.in" % + (filename, path)) + else: + self.assertTrue(True, "no makefile in '%s'" % dir) + +def suite1(): + suite = unittest.TestSuite() + for dir, subdir, files in os.walk('../../src'): + for file in files: + if glob.fnmatch.fnmatch(file,"*.py"): + suite.addTest(TestPOT('test_pot_py_%04d', + dir, file, "import gettext")) + elif glob.fnmatch.fnmatch(file,"*.glade"): + suite.addTest(TestPOT('test_pot_glade_%04d', + dir, file, "translatable=\"yes\"")) + if glob.fnmatch.fnmatch(file,"*.py"): + suite.addTest(TestMake('test_make_py_%04d', dir, file)) + elif glob.fnmatch.fnmatch(file,"*.glade"): + suite.addTest(TestMake('test_make_glade_%04d', dir, file)) + return suite + +if __name__ == "__main__": + unittest.TextTestRunner().run(suite1()) diff --git a/src/PluginUtils/Makefile.am b/src/PluginUtils/Makefile.am index a56f1a375..4ee03e824 100644 --- a/src/PluginUtils/Makefile.am +++ b/src/PluginUtils/Makefile.am @@ -11,7 +11,7 @@ pkgdata_PYTHON = \ _Options.py\ _Tool.py\ _PluginMgr.py\ - _PluginStatus.py\ + _PluginWindows.py\ _Plugins.py pkgpyexecdir = @pkgpyexecdir@/PluginUtils