Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_should_highlight_bash_syntax_without_name failing on openSUSE Tumbleweed #1795

Closed
jayvdb opened this issue Jan 28, 2023 · 1 comment · Fixed by #1797
Closed

test_should_highlight_bash_syntax_without_name failing on openSUSE Tumbleweed #1795

jayvdb opened this issue Jan 28, 2023 · 1 comment · Fixed by #1797

Comments

@jayvdb
Copy link
Contributor

jayvdb commented Jan 28, 2023

This test has started failing out of the blue. I suspect it is due to a more recent version of Markdown, or something similar.

[   67s] =================================== FAILURES ===================================
[   67s] _______ HighlightTagTests.test_should_highlight_bash_syntax_without_name _______
[   67s] 
[   67s] self = <tests.templatetags.test_highlighting.HighlightTagTests testMethod=test_should_highlight_bash_syntax_without_name>
[   67s] 
[   67s]         def test_should_highlight_bash_syntax_without_name(self):
[   67s]             content = """{% load highlighting %}
[   67s]     {% highlight 'bash' %}
[   67s]     echo "Hello $1"
[   67s]     {% endhighlight %}"""
[   67s]             expected_result = '''<div class="highlight"><pre><span></span><span class="nb">echo</span> <span class="s2">&quot;Hello </span><span class="nv">$1</span><span class="s2">&quot;</span>
[   67s]     </pre></div>'''
[   67s]     
[   67s]             result = Template(content).render(self.ctx)
[   67s]     
[   67s] >           self.assertHTMLEqual(result, expected_result)
[   67s] 
[   67s] tests/templatetags/test_highlighting.py:52: 
[   67s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[   67s] /usr/lib/python3.8/site-packages/django/test/testcases.py:1034: in assertHTMLEqual
[   67s]     self.fail(self._formatMessage(msg, standardMsg))
[   67s] E   AssertionError: <div class="highlight">
[   67s] E   <pre>
[   67s] E   <span><span class="nb">
[   67s] E   echo
[   67s] E   </span><span class="w [truncated]... != <div class="highlight">
[   67s] E   <pre>
[   67s] E   <span><span class="nb">
[   67s] E   echo
[   67s] E   </span><span class="s [truncated]...
[   67s] E     <div class="highlight">
[   67s] E     <pre>
[   67s] E     <span><span class="nb">
[   67s] E     echo
[   67s] E   - </span><span class="w"><span class="s2">
[   67s] E   ?              ----------------
[   67s] E   
[   67s] E   + </span><span class="s2">
[   67s] E     &quot;Hello
[   67s] E     </span><span class="nv">
[   67s] E     $1
[   67s] E     </span><span class="s2">
[   67s] E     &quot;
[   67s] E     </span>
[   67s] E     </pre>
[   67s] E     </div>
@foarsitter
Copy link
Contributor

It due to an upgrade of Pygments from 2.13.0 to 2.14.0. According there changelog "The HTML lexer no longer emits empty spans for whitespace (pygments/pygments#2304)". I will submit a PR that updates the test to the new behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants