pypa / readme_renderer

Safely render long_description/README files in Warehouse
Apache License 2.0
157 stars 88 forks source link

clean() returns None in its test #145

Closed bowlofeggs closed 5 years ago

bowlofeggs commented 5 years ago

I see a failing test on Fedora Rawhide:

$ py.test tests/test_clean.py                                                                                           
========================================== test session starts ==========================================
platform linux2 -- Python 2.7.15, pytest-3.9.3, py-1.7.0, pluggy-0.8.0
rootdir: /home/bowlofeggs/rpmbuild/BUILD/readme_renderer-24.0, inifile: pytest.ini
plugins: cov-2.5.1, celery-4.2.1, backports.unittest-mock-1.2.1
collected 1 item                                                                                        

tests/test_clean.py F                                                                             [100%]

=============================================== FAILURES ================================================
___________________________________________ test_invalid_link ___________________________________________

    def test_invalid_link():
>       assert clean('<a href="http://exam](ple.com">foo</a>') == "<a>foo</a>"
E       assert None == '<a>foo</a>'
E        +  where None = clean('<a href="http://exam](ple.com">foo</a>')

tests/test_clean.py:5: AssertionError
=========================================== warnings summary ============================================
/usr/lib/python2.7/site-packages/_pytest/assertion/rewrite.py:272
  /usr/lib/python2.7/site-packages/_pytest/assertion/rewrite.py:272: PytestWarning: Module already imported so cannot be rewritten: backports                                                                     
    self.config,

-- Docs: https://docs.pytest.org/en/latest/warnings.html
================================= 1 failed, 1 warnings in 0.08 seconds ==================================

It does seem that clean() is not returning a str:

$ python3
Python 3.7.1 (default, Nov  5 2018, 09:51:25)
[GCC 8.2.1 20181011 (Red Hat 8.2.1-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from readme_renderer.clean import clean
>>> clean('<a href="http://exam](ple.com">foo</a>')
>>> 
di commented 5 years ago

What version of bleach do you have installed? This changed with the 2.1.4 release, see https://github.com/pypa/readme_renderer/commit/1088e70e3dcb6a07c914bd9cf806f7ef250d5c3e.

bowlofeggs commented 5 years ago

Ah, I have 2.1.3, so I guess I need to update that in Fedora. Thanks!

bowlofeggs commented 5 years ago

This will update Rawhide to 2.1.4 https://src.fedoraproject.org/rpms/python-bleach/pull-request/1