Repository: ansible-community/ansible-pygments (language: python)

Issue:
Test failure with pygments 2.11+
It seems that the output changed in pygments 2.11+, breaking the test:

```pytb
$ tox -e py310
.package create: /tmp/ansible-pygments/.tox/.package
.package installdeps: poetry>=0.12
py310 create: /tmp/ansible-pygments/.tox/py310
py310 installdeps: pytest, pytest-cov
py310 inst: /tmp/ansible-pygments/.tox/.tmp/package/1/ansible-pygments-0.1.0.tar.gz
py310 installed: ansible-pygments @ file:///tmp/ansible-pygments/.tox/.tmp/package/1/ansible-pygments-0.1.0.tar.gz,attrs==21.4.0,coverage==6.3,iniconfig==1.1.1,packaging==21.3,pluggy==1.0.0,py==1.11.0,Pygments==2.11.2,pyparsing==3.0.7,pytest==6.2.5,pytest-cov==3.0.0,toml==0.10.2,tomli==2.0.0
py310 run-test-pre: PYTHONHASHSEED='2677000194'
py310 run-test: commands[0] | /tmp/ansible-pygments/.tox/py310/bin/python -m pytest --color=yes --cov-config=/tmp/ansible-pygments/.coveragerc --cov=/tmp/ansible-pygments/.tox/py310/lib/python3.10/site-packages/ansible_pygments
========================================================= test session starts =========================================================
platform linux -- Python 3.10.2, pytest-6.2.5, py-1.11.0, pluggy-1.0.0 -- /tmp/ansible-pygments/.tox/py310/bin/python
cachedir: .tox/py310/.pytest_cache
rootdir: /tmp/ansible-pygments, configfile: pytest.ini, testpaths: tests/
plugins: cov-3.0.0
collected 1 item                                                                                                                      

tests/lexer_test.py::test_ansible_output_lexer FAILED                                                                           [100%]

============================================================== FAILURES ===============================================================
______________________________________________________ test_ansible_output_lexer ______________________________________________________

    def test_ansible_output_lexer():
        """Test that AnsibleOutputLexer produces expected HTML output."""
        data = R"""
    ok: [windows] => {
        "account": {
            "account_name": "vagrant-domain",
            "type": "User"
        },
        "authentication_package": "Kerberos",
        "user_flags": []
    }
    
    TASK [paused] ************************************************************************************************************************************
    Sunday 11 November 2018  20:16:48 +0100 (0:00:00.041)       0:07:59.637 *******
    --- before
    +++ after
    @@ -1,5 +1,5 @@
     {
    -  "exists": false,
    -  "paused": false,
    -  "running": false
    +  "exists": true,
    +  "paused": true,
    +  "running": true
     }
    \ No newline at end of file
    
    changed: [localhost]
    
    TASK [volumes (more volumes)] ********************************************************************************************************************
    Sunday 11 November 2018  20:19:25 +0100 (0:00:00.607)       0:10:36.974 *******
    --- before
    +++ after
    @@ -1,11 +1,11 @@
     {
       "expected_binds": [
    -    "/tmp:/tmp:rw",
    -    "/:/whatever:rw,z"
    +    "/tmp:/somewhereelse:ro,Z",
    +    "/tmp:/tmp:rw"
       ],
       "expected_volumes": {
    -    "/tmp": {},
    -    "/whatever": {}
    +    "/somewhereelse": {},
    +    "/tmp": {}
       },
       "running": true
     }
    \ No newline at end of file
    
    changed: [localhost]
    """
        _, result = run_test(data, AnsibleOutputLexer())
        print(result)
    
        # pylint: disable=line-too-long
>       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>
        <span class="nt">&quot;account&quot;</span><span class="p">:</span> <span class="p">{</span>
            <span class="nt">&quot;account_name&quot;</span><span class="p">:</span> <span class="s">&quot;vagrant-domain&quot;</span><span class="p">,</span>
            <span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s">&quot;User&quot;</span>
        <span class="p">},</span>
        <span class="nt">&quot;authentication_package&quot;</span><span class="p">:</span> <span class="s">&quot;Kerberos&quot;</span><span class="p">,</span>
        <span class="nt">&quot;user_flags&quot;</span><span class="p">:</span> <span class="p">[]</span>
    <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>
    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>
     {
    <span class="gd">-  &quot;exists&quot;: false,</span>
    <span class="gd">-  &quot;paused&quot;: false,</span>
    <span class="gd">-  &quot;running&quot;: false</span>
    <span class="gi">+  &quot;exists&quot;: true,</span>
    <span class="gi">+  &quot;paused&quot;: true,</span>
    <span class="gi">+  &quot;running&quot;: true</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>
    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>
     {
       &quot;expected_binds&quot;: [
    <span class="gd">-    &quot;/tmp:/tmp:rw&quot;,</span>
    <span class="gd">-    &quot;/:/whatever:rw,z&quot;</span>
    <span class="gi">+    &quot;/tmp:/somewhereelse:ro,Z&quot;,</span>
    <span class="gi">+    &quot;/tmp:/tmp:rw&quot;</span>
       ],
       &quot;expected_volumes&quot;: {
    <span class="gd">-    &quot;/tmp&quot;: {},</span>
    <span class="gd">-    &quot;/whatever&quot;: {}</span>
    <span class="gi">+    &quot;/somewhereelse&quot;: {},</span>
    <span class="gi">+    &quot;/tmp&quot;: {}</span>
       },
       &quot;running&quot;: true
     }
    \ 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>
    """
E       assert '<div class=".../pre></div>\n' == '<div class=".../pre></div>\n'
E           <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>
E               <span class="nt">&quot;account&quot;</span><span class="p">:</span> <span class="p">{</span>
E                   <span class="nt">&quot;account_name&quot;</span><span class="p">:</span> <span class="s">&quot;vagrant-domain&quot;</span><span class="p">,</span>
E                   <span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s">&quot...
E         
E         ...Full output truncated (100 lines hidden), use '-vv' to show

_          = 'pre { line-height: 125%; }\ntd.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; pa... .vm { color: #19177C } /* Name.Variable.Magic */\n.highlight .il { color: #666666 } /* Literal.Number.Integer.Long */'
data       = '\nok: [windows] => {\n    "account": {\n        "account_name": "vagrant-domain",\n        "type": "User"\n    },\n  ...hereelse": {},\n+    "/tmp": {}\n   },\n   "running": true\n }\n\\ No newline at end of file\n\nchanged: [localhost]\n'
result     = '<div class="highlight"><pre><span></span><span class="k">ok</span><span class="p">:</span> <span class="p">[</span><s...n class="p">:</span> <span class="p">[</span><span class="nv">localhost</span><span class="p">]</span>\n</pre></div>\n'

tests/lexer_test.py:78: AssertionError
-------------------------------------------------------- Captured stdout call ---------------------------------------------------------
<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>
    <span class="nt">&quot;account&quot;</span><span class="p">:</span> <span class="p">{</span>
        <span class="nt">&quot;account_name&quot;</span><span class="p">:</span> <span class="s">&quot;vagrant-domain&quot;</span><span class="p">,</span>
        <span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s">&quot;User&quot;</span>
    <span class="p">},</span>
    <span class="nt">&quot;authentication_package&quot;</span><span class="p">:</span> <span class="s">&quot;Kerberos&quot;</span><span class="p">,</span>
    <span class="nt">&quot;user_flags&quot;</span><span class="p">:</span> <span class="p">[]</span>
<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>
<span class="gd">--- before</span><span class="w"></span>
<span class="gi">+++ after</span><span class="w"></span>
<span class="gu">@@ -1,5 +1,5 @@</span><span class="w"></span>
<span class="w"> </span>{<span class="w"></span>
<span class="gd">-  &quot;exists&quot;: false,</span><span class="w"></span>
<span class="gd">-  &quot;paused&quot;: false,</span><span class="w"></span>
<span class="gd">-  &quot;running&quot;: false</span><span class="w"></span>
<span class="gi">+  &quot;exists&quot;: true,</span><span class="w"></span>
<span class="gi">+  &quot;paused&quot;: true,</span><span class="w"></span>
<span class="gi">+  &quot;running&quot;: true</span><span class="w"></span>
<span class="w"> </span>}<span class="w"></span>
<span class="w">\ No newline at end of file</span>

<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>
<span class="gd">--- before</span><span class="w"></span>
<span class="gi">+++ after</span><span class="w"></span>
<span class="gu">@@ -1,11 +1,11 @@</span><span class="w"></span>
<span class="w"> </span>{<span class="w"></span>
<span class="w"> </span>  &quot;expected_binds&quot;: [<span class="w"></span>
<span class="gd">-    &quot;/tmp:/tmp:rw&quot;,</span><span class="w"></span>
<span class="gd">-    &quot;/:/whatever:rw,z&quot;</span><span class="w"></span>
<span class="gi">+    &quot;/tmp:/somewhereelse:ro,Z&quot;,</span><span class="w"></span>
<span class="gi">+    &quot;/tmp:/tmp:rw&quot;</span><span class="w"></span>
<span class="w"> </span>  ],<span class="w"></span>
<span class="w"> </span>  &quot;expected_volumes&quot;: {<span class="w"></span>
<span class="gd">-    &quot;/tmp&quot;: {},</span><span class="w"></span>
<span class="gd">-    &quot;/whatever&quot;: {}</span><span class="w"></span>
<span class="gi">+    &quot;/somewhereelse&quot;: {},</span><span class="w"></span>
<span class="gi">+    &quot;/tmp&quot;: {}</span><span class="w"></span>
<span class="w"> </span>  },<span class="w"></span>
<span class="w"> </span>  &quot;running&quot;: true<span class="w"></span>
<span class="w"> </span>}<span class="w"></span>
<span class="w">\ No newline at end of file</span>

<span class="k">changed</span><span class="p">:</span> <span class="p">[</span><span class="nv">localhost</span><span class="p">]</span>
</pre></div>

----------------------------- generated xml file: /tmp/ansible-pygments/.test-results/pytest/results.xml ------------------------------
======================================================== slowest 10 durations =========================================================
0.14s call     tests/lexer_test.py::test_ansible_output_lexer
0.01s setup    tests/lexer_test.py::test_ansible_output_lexer

(1 durations < 0.005s hidden.  Use -vv to show these durations.)
======================================================= short test summary info =======================================================
FAILED tests/lexer_test.py::test_ansible_output_lexer - assert '<div class=".../pre></div>\n' == '<div class=".../pre></div>\n'
========================================================== 1 failed in 0.41s ==========================================================
ERROR: InvocationError for command /tmp/ansible-pygments/.tox/py310/bin/python -m pytest --color=yes --cov-config=/tmp/ansible-pygments/.coveragerc --cov=/tmp/ansible-pygments/.tox/py310/lib/python3.10/site-packages/ansible_pygments (exited with code 1)
_______________________________________________________________ summary _______________________________________________________________
ERROR:   py310: commands failed
```


Discussion / hints:

Fix patch:
diff --git a/src/ansible_pygments/lexers.py b/src/ansible_pygments/lexers.py
index ab0979a..73fb951 100644
--- a/src/ansible_pygments/lexers.py
+++ b/src/ansible_pygments/lexers.py
@@ -34,6 +34,8 @@
 
 """Pygments lexers for ansible console output."""
 
+# pylint: disable=consider-using-f-string
+
 from pygments import token
 from pygments.lexer import DelegatingLexer, RegexLexer, bygroups, include
 from pygments.lexers import DiffLexer  # pylint: disable=no-name-in-module


Test patch:
diff --git a/tests/lexer_test.py b/tests/lexer_test.py
index 07d8b9e..059833a 100644
--- a/tests/lexer_test.py
+++ b/tests/lexer_test.py
@@ -85,43 +85,43 @@ def test_ansible_output_lexer():
 <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>
-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>
- {
-<span class="gd">-  &quot;exists&quot;: false,</span>
-<span class="gd">-  &quot;paused&quot;: false,</span>
-<span class="gd">-  &quot;running&quot;: false</span>
-<span class="gi">+  &quot;exists&quot;: true,</span>
-<span class="gi">+  &quot;paused&quot;: true,</span>
-<span class="gi">+  &quot;running&quot;: true</span>
- }
-\ No newline at end of file
+<span class="w">Sunday 11 November 2018  20:16:48 +0100 (0:00:00.041)       0:07:59.637 *******</span>
+<span class="gd">--- before</span><span class="w"></span>
+<span class="gi">+++ after</span><span class="w"></span>
+<span class="gu">@@ -1,5 +1,5 @@</span><span class="w"></span>
+<span class="w"> </span>{<span class="w"></span>
+<span class="gd">-  &quot;exists&quot;: false,</span><span class="w"></span>
+<span class="gd">-  &quot;paused&quot;: false,</span><span class="w"></span>
+<span class="gd">-  &quot;running&quot;: false</span><span class="w"></span>
+<span class="gi">+  &quot;exists&quot;: true,</span><span class="w"></span>
+<span class="gi">+  &quot;paused&quot;: true,</span><span class="w"></span>
+<span class="gi">+  &quot;running&quot;: true</span><span class="w"></span>
+<span class="w"> </span>}<span class="w"></span>
+<span class="w">\ No newline at end of file</span>
 
 <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>
-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>
- {
-   &quot;expected_binds&quot;: [
-<span class="gd">-    &quot;/tmp:/tmp:rw&quot;,</span>
-<span class="gd">-    &quot;/:/whatever:rw,z&quot;</span>
-<span class="gi">+    &quot;/tmp:/somewhereelse:ro,Z&quot;,</span>
-<span class="gi">+    &quot;/tmp:/tmp:rw&quot;</span>
-   ],
-   &quot;expected_volumes&quot;: {
-<span class="gd">-    &quot;/tmp&quot;: {},</span>
-<span class="gd">-    &quot;/whatever&quot;: {}</span>
-<span class="gi">+    &quot;/somewhereelse&quot;: {},</span>
-<span class="gi">+    &quot;/tmp&quot;: {}</span>
-   },
-   &quot;running&quot;: true
- }
-\ No newline at end of file
+<span class="w">Sunday 11 November 2018  20:19:25 +0100 (0:00:00.607)       0:10:36.974 *******</span>
+<span class="gd">--- before</span><span class="w"></span>
+<span class="gi">+++ after</span><span class="w"></span>
+<span class="gu">@@ -1,11 +1,11 @@</span><span class="w"></span>
+<span class="w"> </span>{<span class="w"></span>
+<span class="w"> </span>  &quot;expected_binds&quot;: [<span class="w"></span>
+<span class="gd">-    &quot;/tmp:/tmp:rw&quot;,</span><span class="w"></span>
+<span class="gd">-    &quot;/:/whatever:rw,z&quot;</span><span class="w"></span>
+<span class="gi">+    &quot;/tmp:/somewhereelse:ro,Z&quot;,</span><span class="w"></span>
+<span class="gi">+    &quot;/tmp:/tmp:rw&quot;</span><span class="w"></span>
+<span class="w"> </span>  ],<span class="w"></span>
+<span class="w"> </span>  &quot;expected_volumes&quot;: {<span class="w"></span>
+<span class="gd">-    &quot;/tmp&quot;: {},</span><span class="w"></span>
+<span class="gd">-    &quot;/whatever&quot;: {}</span><span class="w"></span>
+<span class="gi">+    &quot;/somewhereelse&quot;: {},</span><span class="w"></span>
+<span class="gi">+    &quot;/tmp&quot;: {}</span><span class="w"></span>
+<span class="w"> </span>  },<span class="w"></span>
+<span class="w"> </span>  &quot;running&quot;: true<span class="w"></span>
+<span class="w"> </span>}<span class="w"></span>
+<span class="w">\ No newline at end of file</span>
 
 <span class="k">changed</span><span class="p">:</span> <span class="p">[</span><span class="nv">localhost</span><span class="p">]</span>
 </pre></div>