ansible-community / ansible-pygments

Provides Pygments highlighter for Ansible output for use in Sphinx

Home Page:https://pypi.org/p/ansible-pygments

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Test failure with pygments 2.15

ogayot opened this issue · comments

Hello,

The test suite fails against pygments 2.15:

Traceback (most recent call last):
  File "/home/olivier/dev/canonical/ansible-pygments/tests/lexer_test.py", line 131, in <module>
    test_ansible_output_lexer()
  File "/home/olivier/dev/canonical/ansible-pygments/tests/lexer_test.py", line 78, in test_ansible_output_lexer
    assert result == R"""<div class="highlight"><pre><span></span><span class="k">ok</span><span class="p">:</span> <span class="p">[</span><span class="nv">windows</span><span class="p">]</span> <span class="p">=&gt;</span> <span class="p">{</span>
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

Here is the diff of the output:

--- pygments-2.14.html	2023-05-11 18:25:10.635761541 +0200
+++ pygments-2.15.html	2023-05-11 18:31:31.421693061 +0200
@@ -8,7 +8,7 @@
 <span class="p">}</span>
 
 <span class="k">TASK</span> <span class="p">[</span><span class="l">paused</span><span class="p">]</span> <span class="nv">************************************************************************************************************************************</span>
-<span class="w">Sunday 11 November 2018  20:16:48 +0100 (0:00:00.041)       0:07:59.637 *******</span>
+Sunday 11 November 2018  20:16:48 +0100 (0:00:00.041)       0:07:59.637 *******
 <span class="gd">--- before</span>
 <span class="gi">+++ after</span>
 <span class="gu">@@ -1,5 +1,5 @@</span>
@@ -20,12 +20,12 @@
 <span class="gi">+  &quot;paused&quot;: true,</span>
 <span class="gi">+  &quot;running&quot;: true</span>
 <span class="w"> </span>}
-<span class="w">\ No newline at end of file</span>
+\ No newline at end of file
 
 <span class="k">changed</span><span class="p">:</span> <span class="p">[</span><span class="nv">localhost</span><span class="p">]</span>
 
 <span class="k">TASK</span> <span class="p">[</span><span class="l">volumes (more volumes)</span><span class="p">]</span> <span class="nv">********************************************************************************************************************</span>
-<span class="w">Sunday 11 November 2018  20:19:25 +0100 (0:00:00.607)       0:10:36.974 *******</span>
+Sunday 11 November 2018  20:19:25 +0100 (0:00:00.607)       0:10:36.974 *******
 <span class="gd">--- before</span>
 <span class="gi">+++ after</span>
 <span class="gu">@@ -1,11 +1,11 @@</span>
@@ -44,7 +44,7 @@
 <span class="w"> </span>  },
 <span class="w"> </span>  &quot;running&quot;: true
 <span class="w"> </span>}
-<span class="w">\ No newline at end of file</span>
+\ No newline at end of file
 
 <span class="k">changed</span><span class="p">:</span> <span class="p">[</span><span class="nv">localhost</span><span class="p">]</span>
 </pre></div>

According to git bisect, the ansible-pygments test failure started with pygments/pygments@4159c08

Does it sound safe to modify the tests to remove the <span class="w"> around the date and "\ No newline at end of file"? Or does it sounds like an actual regression?

Thanks!
Olivier

@ogayot thanks for the report! I was right in the progress of fixing that :)
I rewrote that test to rely on tokens that lexer emits skipping feeding it to the formatter. It's now fixed via #34.

@webknjaz I appreciate the quick work! Thanks for that. I confirm that the issue is fixed.

Best regards,
Olivier