git.iko.soy/typeable/nixpkgs
on master help sign in
pythonPackages.sphinx: fix tests with Pygments 2.1

Close #12511.

commit9f6ca0fe15a1f01ad2960648fc1e9d2d5a5cdb9e authorTobias Geerinckx-Rice <tobias.geerinckx.rice@gmail.com> dateThu 21 Jan 2016, 01:46 (11 years ago) parent67c487f
2 files changed+64
pkgs/development/python-modules/sphinx-fix-tests-with-pygments-2.1.patch+63 pkgs/top-level/python-packages.nix+1
pkgs/development/python-modules/sphinx-fix-tests-with-pygments-2.1.patchnew file+63
@@ -0,0 +1,63 @@
1+From 5574aba60ed76f2bae947722122ac4d71ab8ed5a Mon Sep 17 00:00:00 2001
2+From: Takeshi KOMIYA <i.tkomiya@gmail.com>
3+Date: Mon, 18 Jan 2016 12:38:02 +0900
4+Subject: [PATCH] Fix tests are broken with pygments-2.1
5+
6+---
7+ tests/test_build_html.py | 2 +-
8+ tests/test_intl.py | 10 ++++++----
9+ 2 files changed, 7 insertions(+), 5 deletions(-)
10+
11+diff --git a/tests/test_build_html.py b/tests/test_build_html.py
12+index e330761..17ea089 100644
13+--- a/tests/test_build_html.py
14++++ b/tests/test_build_html.py
15+@@ -82,7 +82,7 @@ def checker(nodes):
16+ (".//a[@href='_downloads/img1.png']", ''),
17+ (".//pre", u'"quotes"'),
18+ (".//pre", u"'included'"),
19+- (".//pre/span[@class='s']", u'üöä'),
20++ (".//pre/span[@class='s2']", u'üöä'),
21+ (".//div[@class='inc-pyobj1 highlight-text']//pre",
22+ r'^class Foo:\n pass\n\s*$'),
23+ (".//div[@class='inc-pyobj2 highlight-text']//pre",
24+diff --git a/tests/test_intl.py b/tests/test_intl.py
25+index 4c665d4..b24ec65 100644
26+--- a/tests/test_intl.py
27++++ b/tests/test_intl.py
28+@@ -694,14 +694,15 @@ def test_additional_targets_should_not_be_translated(app, status, warning):
29+ yield assert_count(expected_expr, result, 1)
30+
31+ # C code block with lang should not be translated but be *C* highlighted
32+- expected_expr = """<span class="cp">#include &lt;stdio.h&gt;</span>"""
33++ expected_expr = ("""<span class="cp">#include</span> """
34++ """<span class="cpf">&lt;stdio.h&gt;</span>""")
35+ yield assert_count(expected_expr, result, 1)
36+
37+ # doctest block should not be translated but be highlighted
38+ expected_expr = (
39+ """<span class="gp">&gt;&gt;&gt; </span>"""
40+ """<span class="kn">import</span> <span class="nn">sys</span> """
41+- """<span class="c"># sys importing</span>""")
42++ """<span class="c1"># sys importing</span>""")
43+ yield assert_count(expected_expr, result, 1)
44+
45+ ## raw.txt
46+@@ -754,14 +755,15 @@ def test_additional_targets_should_be_translated(app, status, warning):
47+ yield assert_count(expected_expr, result, 1)
48+
49+ # C code block with lang should be translated and be *C* highlighted
50+- expected_expr = """<span class="cp">#include &lt;STDIO.H&gt;</span>"""
51++ expected_expr = ("""<span class="cp">#include</span> """
52++ """<span class="cpf">&lt;STDIO.H&gt;</span>""")
53+ yield assert_count(expected_expr, result, 1)
54+
55+ # doctest block should not be translated but be highlighted
56+ expected_expr = (
57+ """<span class="gp">&gt;&gt;&gt; </span>"""
58+ """<span class="kn">import</span> <span class="nn">sys</span> """
59+- """<span class="c"># SYS IMPORTING</span>""")
60++ """<span class="c1"># SYS IMPORTING</span>""")
61+ yield assert_count(expected_expr, result, 1)
62+
63+ ## raw.txt
pkgs/top-level/python-packages.nix+1
@@ -18910,6 +18910,7 @@ in modules // {
1891018910 sha256 = "0mw06q7bzzjylgwh0wnnaxmwc95hx8w95as4vcgpan579brw7b4a";
1891118911 };
1891218912
18913+ patches = [ ../development/python-modules/sphinx-fix-tests-with-pygments-2.1.patch ];
1891318914 LC_ALL = "en_US.UTF-8";
1891418915 checkPhase = ''
1891518916 PYTHON=${python.executable} make test