aboutsummaryrefslogtreecommitdiffstats
path: root/community/notmuch/fix-tests-for-python3.patch
blob: 1b71751db49febba78dd50c0b06260110bcc7b72 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Fix test-lib.sh for Python 3.5+.

Since Python 3.5 json.tool does not sort JSON keys unless --sort-keys
is specified.
See https://docs.python.org/3/library/json.html#module-json.tool.

--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -627,9 +627,9 @@
     # The test suite forces LC_ALL=C, but this causes Python 3 to
     # decode stdin as ASCII.  We need to read JSON in UTF-8, so
     # override Python's stdio encoding defaults.
-    output=$(echo "$1" | PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON -mjson.tool \
+    output=$(echo "$1" | PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON -mjson.tool --sort-keys \
         || echo "$1")
-    expected=$(echo "$2" | PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON -mjson.tool \
+    expected=$(echo "$2" | PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON -mjson.tool --sort-keys \
         || echo "$2")
     shift 2
     test_expect_equal "$output" "$expected" "$@"