Roundup Tracker - Issues

Issue 2551335

classification
FAILED test/test_templating.py::Markdown2TestCase::test_markdown_hyperlinked_url - AssertionError
Type: compile error Severity: normal
Components: Test Versions: 2.3.0
process
Status: closed out of date
:
: rouilj : ceamac, rouilj
Priority: : Blocker

Created on 2024-04-20 11:48 by ceamac, last changed 2024-04-20 18:15 by rouilj.

Messages
msg7989 Author: [hidden] (ceamac) Date: 2024-04-20 11:48
Thank you for fixing issue #2551272

There are 2 more tests that fail in test_templating.py::Markdown2TestCase, tested with python 3.11 and python 3.12.

_______________________________________ Markdown2TestCase.test_markdown_hyperlinked_url _______________________________________

self = <test.test_templating.Markdown2TestCase testMethod=test_markdown_hyperlinked_url>

    def test_markdown_hyperlinked_url(self):
        # classic markdown does not emit a \n at end of rendered string
        # so rstrip \n.
        p = StringHTMLProperty(self.client, 'test', '1', None, 'test', u2s(u'http://example.com/'))
        m = p.markdown(hyperlink=1)
        m = self.mangleMarkdown2(m)
        print(m)
        self.assertEqual(m.rstrip('\n'), '<p><a href="http://example.com/" rel="nofollow noopener">http://example.com/</a></p>')
    
        p = StringHTMLProperty(self.client, 'test', '1', None, 'test', u2s(u'<http://example.com/>'))
        m = p.markdown(hyperlink=1)
        m = self.mangleMarkdown2(m)
        self.assertEqual(m.rstrip('\n'), '<p><a href="http://example.com/" rel="nofollow noopener">http://example.com/</a></p>')
    
        p = StringHTMLProperty(self.client, 'test', '1', None, 'test', u2s(u'[label](http://example.com/ "a title")'))
        m = p.markdown(hyperlink=1)
        m = self.mangleMarkdown2(m)
>       self.assertEqual(m.rstrip('\n'), '<p><a href="http://example.com/" rel="nofollow noopener" title="a title">label</a></p>')
E       AssertionError: '<p><a href="#" title="a title">label</a></p>' != '<p><a href="http://example.com/" rel="nofollow noopen[29 chars]</p>'
E       - <p><a href="#" title="a title">label</a></p>
E       + <p><a href="http://example.com/" rel="nofollow noopener" title="a title">label</a></p>

m          = '<p><a href="#" title="a title">label</a></p>\n'
p          = <StringHTMLProperty(0x7f51dac3b450) test1@test None '[label](http://example.com/ "a title")'>
self       = <test.test_templating.Markdown2TestCase testMethod=test_markdown_hyperlinked_url>

test/test_templating.py:908: AssertionError
---------------------------------------------------- Captured stdout call -----------------------------------------------------
<p><a href="http://example.com/" rel="nofollow noopener">http://example.com/</a></p>
msg7992 Author: [hidden] (rouilj) Date: 2024-04-20 16:45
Hello Viorel:

I can't reproduce this with the current development head when running:

====
python3 -m pytest -k "markdown2 and test_markdown_hyperlinked_url" test
..
test/test_templating.py::Markdown2TestCase::test_markdown_hyperlinked_url PASSED [100%]
...
_______________ Markdown2TestCase.test_markdown_hyperlinked_url ________________
----------------------------- Captured stdout call -----------------------------
<p><a href="http://example.com/" rel="nofollow noopener">http://example.com/</a></p>
===

With Python 3.8.10. But this same test has been passing in CI with both
3.11 and 3.12 and markdown2 <= 2.4.8

I ran it on my dev system with markdown2 version:

   python3 -c 'import markdown2; print(markdown2.__version__)'
   2.4.12

I also upgraded markdown2 to 2.4.13 and it still passes.

What version of markdown2 are you using?
What version of Roundup are you using?

It's possible something breaks with markdown 2.4.9+ and newer Python.
It's also possible it's fixed in devel (2.4.0 beta next month).

The markdown2 limitation has been lifted (needed a bug fix in markdown2),
so CI is running 3.11 and 3.12 with the newest 2.4.13 version as I type.
msg7993 Author: [hidden] (ceamac) Date: 2024-04-20 17:21
Hi,

I use markdown2 2.4.13 and roundup 2.3.0

I tested again in a venv and I get the same error, so probably it's fixed in devel.  Thank you!
msg7994 Author: [hidden] (rouilj) Date: 2024-04-20 17:45
If you have a venv, you can test the current development release in your
venv and verify that the issue is gone.

  . path/to/your/venv/activate
  mkdir /tmp/r
  cd /tmp/r
  git clone https://github.com/roundup-tracker/roundup.git
  cd roundup
  python3 -m pytest -k "markdown2 and test_markdown_hyperlinked_url" test

should do the trick.
msg7995 Author: [hidden] (ceamac) Date: 2024-04-20 17:50
$ python3 -m pytest -k "markdown2 and test_markdown_hyperlinked_url" test
===================================================================================================================== test session starts ======================================================================================================================
platform linux -- Python 3.11.9, pytest-8.1.1, pluggy-1.4.0 -- /home/viorel/testroundup/bin/python3
cachedir: .pytest_cache
rootdir: /home/viorel/testroundup/roundup
configfile: pyproject.toml
collected 2275 items / 2274 deselected / 1 skipped / 1 selected                                                                                                                                                                                                

test/test_templating.py::Markdown2TestCase::test_markdown_hyperlinked_url PASSED                                                                                                                                                                         [100%]

It passed, this can be closed.  Thank you for your support.
History
Date User Action Args
2024-04-20 18:15:12rouiljsetstatus: open -> closed
resolution: remind -> out of date
2024-04-20 17:50:06ceamacsetmessages: + msg7995
2024-04-20 17:45:20rouiljsetkeywords: + Blocker
resolution: remind
messages: + msg7994
2024-04-20 17:21:19ceamacsetmessages: + msg7993
2024-04-20 16:45:45rouiljsetstatus: new -> open
assignee: rouilj
messages: + msg7992
nosy: + rouilj
2024-04-20 16:19:58rouiljlinkissue2551336 superseder
2024-04-20 11:48:00ceamaccreate