1 |
commit: a7ee4cda4858f179540c396ce79bc9b3dfc95f3d |
2 |
Author: Marek Szuba <marecki <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat May 15 14:10:54 2021 +0000 |
4 |
Commit: Marek Szuba <marecki <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat May 15 14:22:01 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a7ee4cda |
7 |
|
8 |
app-misc/gramps: tests: do not rely on presence of en_US.UTF-8 locale |
9 |
|
10 |
Signed-off-by: Marek Szuba <marecki <AT> gentoo.org> |
11 |
|
12 |
.../gramps/files/gramps-5.1.3-test_locale.patch | 30 ++++++++++++++++++++++ |
13 |
app-misc/gramps/gramps-5.1.3.ebuild | 16 +++++++++--- |
14 |
2 files changed, 42 insertions(+), 4 deletions(-) |
15 |
|
16 |
diff --git a/app-misc/gramps/files/gramps-5.1.3-test_locale.patch b/app-misc/gramps/files/gramps-5.1.3-test_locale.patch |
17 |
new file mode 100644 |
18 |
index 00000000000..40eba66dd21 |
19 |
--- /dev/null |
20 |
+++ b/app-misc/gramps/files/gramps-5.1.3-test_locale.patch |
21 |
@@ -0,0 +1,30 @@ |
22 |
+GEDCOM-import tests explicitly set the locale to en_US.UTF8 because they |
23 |
+assume a US date and time format. That locale is not guaranteed to be |
24 |
+present and checking that in ebuild is a hassle, therefore use C.UTF8 |
25 |
+instead - it's similar enough. |
26 |
+ |
27 |
+--- a/data/tests/imp_sample.gramps |
28 |
++++ b/data/tests/imp_sample.gramps |
29 |
+@@ -1706,7 +1706,7 @@ |
30 |
+ </style> |
31 |
+ </note> |
32 |
+ <note handle="_000000f9000000f9" change="1591544255" id="N0036" type="General"> |
33 |
+- <text>Objects referenced by this note were missing in a file imported on 12/25/1999 12:00:00 AM.</text> |
34 |
++ <text>Objects referenced by this note were missing in a file imported on 12/25/99 00:00:00.</text> |
35 |
+ </note> |
36 |
+ </notes> |
37 |
+ </database> |
38 |
+--- a/gramps/plugins/test/imports_test.py |
39 |
++++ b/gramps/plugins/test/imports_test.py |
40 |
+@@ -51,10 +51,7 @@ |
41 |
+ # ------------------------------------------------------------------ |
42 |
+ |
43 |
+ # These tests assume a US date and time format. |
44 |
+-try: |
45 |
+- locale.setlocale(locale.LC_ALL, 'en_US.utf8') |
46 |
+-except locale.Error: # seems to fail on Windows system for some reason |
47 |
+- locale.setlocale(locale.LC_ALL, 'English_United States') |
48 |
++locale.setlocale(locale.LC_ALL, 'C.utf8') |
49 |
+ |
50 |
+ |
51 |
+ def mock_time(*args): |
52 |
|
53 |
diff --git a/app-misc/gramps/gramps-5.1.3.ebuild b/app-misc/gramps/gramps-5.1.3.ebuild |
54 |
index 9908893b3c3..0c5ddbf8781 100644 |
55 |
--- a/app-misc/gramps/gramps-5.1.3.ebuild |
56 |
+++ b/app-misc/gramps/gramps-5.1.3.ebuild |
57 |
@@ -44,6 +44,10 @@ BDEPEND="test? ( ${RDEPEND} |
58 |
') |
59 |
)" |
60 |
|
61 |
+PATCHES=( |
62 |
+ "${FILESDIR}"/${PN}-5.1.3-test_locale.patch |
63 |
+) |
64 |
+ |
65 |
python_prepare_all() { |
66 |
# Install documentation to the proper location. This can't be done |
67 |
# easily with a patch because we substitute in the ${PF} variable, |
68 |
@@ -67,10 +71,14 @@ python_test_all() { |
69 |
rm -rf "${S}/build" && ln -s "${BUILD_DIR}" "${S}"/build || \ |
70 |
die "Failed to symlink build directory to source directory" |
71 |
|
72 |
- # FIXME: some of the tests fail if the locale 'en_US.UTF-8' is absent, |
73 |
- # at least as of 5.1.2 this failure does not propagate back to this |
74 |
- # function but we should still handle this properly somehow. |
75 |
- esetup.py test |
76 |
+ # Set a sane default locale for the tests which do not explicitly set one. |
77 |
+ local -x LC_ALL=C.UTF-8 |
78 |
+ |
79 |
+ # Note that as of 5.1.3, test failures do not actually propagate back |
80 |
+ # to this function. For now this is fortunate because the test suite |
81 |
+ # does not handle the absence of bsddb3 well, in the long run however |
82 |
+ # this should be fixed. |
83 |
+ esetup.py test || die |
84 |
} |
85 |
|
86 |
# Ugly hack to work around Bug #717922 |