From 879218475e3d85b7e238dec13b03d07a0b3006dc Mon Sep 17 00:00:00 2001 From: Vassilii Khachaturov Date: Thu, 29 Aug 2013 22:48:54 +0000 Subject: [PATCH] flags HAS_CLIMERGE and HAS_EXPORTRAW to skip tests Thanks, Nick! svn: r22948 --- gramps/gen/merge/test/merge_ref_test.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gramps/gen/merge/test/merge_ref_test.py b/gramps/gen/merge/test/merge_ref_test.py index bb2409987..c3913c12a 100644 --- a/gramps/gen/merge/test/merge_ref_test.py +++ b/gramps/gen/merge/test/merge_ref_test.py @@ -40,6 +40,9 @@ from ...lib import Name, Surname from ...const import GRAMPS_LOCALE as glocale _ = glocale.translation.sgettext +HAS_CLIMERGE = os.path.isdir(os.path.join(USER_PLUGINS, 'CliMerge')) +HAS_EXPORTRAW = os.path.isdir(os.path.join(USER_PLUGINS, 'ExportRaw')) + class CopiedDoc(object): """Context manager that creates a deep copy of an libxml-xml document.""" def __init__(self, xmldoc): @@ -70,6 +73,8 @@ class XpathContext(object): self.ctxt.xpathFreeContext() return False +@unittest.skipUnless(HAS_CLIMERGE and HAS_EXPORTRAW, + 'These tests need the 3rd-party plugins "CliMerge" and "ExportRaw".') class BaseMergeCheck(unittest.TestCase): def base_setup(self): """Set up code needed by all tests.""" @@ -2221,4 +2226,11 @@ class FamilyMergeCheck(BaseMergeCheck): if __name__ == "__main__": + import sys + if not HAS_CLIMERGE: + print('This program needs the third party "CliMerge" plugin.', file=sys.stderr) + sys.exit(1) + if not HAS_EXPORTRAW: + print('This program needs the third party "ExportRaw" plugin.', file=sys.stderr) + sys.exit(1) unittest.main()