Codebase list gramps / 71b88db
Patch to skip some tests if system language is not English IOhannes m zmölnig 2 years ago
2 changed file(s) with 100 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
00 skip_faulty_deletetree_test.patch
1 skip_englishonly_tests.patch
0 Description: Skip tests that rely on the locale to be set to English
1 at least, if the locale is currently *not* English
2 Author: IOhannes m zmölnig
3 Origin: Debian
4 Bug: https://gramps-project.org/bugs/view.php?id=12578
5 Last-Update: 2022-02-25
6 ---
7 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
8 --- gramps.orig/gramps/gen/filters/rules/test/event_rules_test.py
9 +++ gramps/gramps/gen/filters/rules/test/event_rules_test.py
10 @@ -39,6 +39,12 @@
11 EXAMPLE = os.path.join(TEST_DIR, "example.gramps")
12 GenericEventFilter = GenericFilterFactory('Event')
13
14 +def skipIfNotEnglish(obj):
15 + from ....utils.grampslocale import GrampsLocale
16 + if not GrampsLocale().language[0].startswith("en"):
17 + obj.skipTest("skipping test for non-English language %s" % (GrampsLocale().language,))
18 +
19 +
20 class BaseTest(unittest.TestCase):
21 """
22 Event rule tests.
23 @@ -171,6 +177,7 @@
24 """
25 Test HasData rule.
26 """
27 + skipIfNotEnglish(self)
28 rule = HasData(['Burial', 'before 1800', 'USA', ''])
29 self.assertEqual(self.filter_with_rule(rule), set([
30 'a5af0ed4211095487d2', 'a5af0ed36793c1d3e05',
31 --- gramps.orig/gramps/gen/filters/rules/test/family_rules_test.py
32 +++ gramps/gramps/gen/filters/rules/test/family_rules_test.py
33 @@ -41,6 +41,11 @@
34 EXAMPLE = os.path.join(TEST_DIR, "example.gramps")
35 GenericFamilyFilter = GenericFilterFactory('Family')
36
37 +def skipIfNotEnglish(obj):
38 + from ....utils.grampslocale import GrampsLocale
39 + if not GrampsLocale().language[0].startswith("en"):
40 + obj.skipTest("skipping test for non-English language %s" % (GrampsLocale().language,))
41 +
42 class BaseTest(unittest.TestCase):
43 """
44 Family rule tests.
45 @@ -176,6 +181,7 @@
46 """
47 Test HasEvent rule.
48 """
49 + skipIfNotEnglish(self)
50 rule = HasEvent(['Marriage', 'before 1900', 'USA', '', 'Garner'])
51 self.assertEqual(self.filter_with_rule(rule), set([
52 'KSFKQCP4V0YXGM1LR9', '8ZFKQC3FRSHACOJBOU', '3XFKQCE7QUDJ99AVNV',
53 --- gramps.orig/gramps/gen/filters/rules/test/person_rules_test.py
54 +++ gramps/gramps/gen/filters/rules/test/person_rules_test.py
55 @@ -59,6 +59,11 @@
56 TEST_DIR = os.path.abspath(os.path.join(DATA_DIR, "tests"))
57 EXAMPLE = os.path.join(TEST_DIR, "example.gramps")
58
59 +def skipIfNotEnglish(obj):
60 + from ....utils.grampslocale import GrampsLocale
61 + if not GrampsLocale().language[0].startswith("en"):
62 + obj.skipTest("skipping test for non-English language %s" % (GrampsLocale().language,))
63 +
64 class BaseTest(unittest.TestCase):
65 """
66 Person rule tests.
67 @@ -238,6 +243,7 @@
68 """
69 Test rule.
70 """
71 + skipIfNotEnglish(self)
72 rule = HasBirth(['between 1600 and 1700', 'akron', ''])
73 res = self.filter_with_rule(rule)
74 self.assertEqual(len(res), 2)
75 @@ -246,6 +252,7 @@
76 """
77 Test HasDeath rule.
78 """
79 + skipIfNotEnglish(self)
80 rule = HasDeath(['between 1600 and 1700', 'ashtabula', ''])
81 res = self.filter_with_rule(rule)
82 self.assertEqual(len(res), 2)
83 @@ -254,6 +261,7 @@
84 """
85 Test rule.
86 """
87 + skipIfNotEnglish(self)
88 rule = HasEvent(['Birth', 'between 1600 and 1700', 'akron',
89 '', '', 1])
90 res = self.filter_with_rule(rule)
91 @@ -271,6 +279,7 @@
92 """
93 Test rule.
94 """
95 + skipIfNotEnglish(self)
96 rule = HasFamilyEvent(['Marriage', 'after 1900', 'craw', ''])
97 res = self.filter_with_rule(rule)
98 self.assertEqual(len(res), 4)