plone / plone.app.discussion

General commenting system for Plone content
https://pypi.org/project/plone.app.discussion
16 stars 47 forks source link

Test-only fix: normalize white space when comparing output of getText #202

Closed mauritsvanrees closed 2 years ago

mauritsvanrees commented 2 years ago

Needed to not fail with newer plone.outputfilters from this PR: https://github.com/plone/plone.outputfilters/pull/49 The tests then pass for both plone.outputfilters master and the PR branch.

Comments go through the outputfilters, and the PR branch calls soup.prettify() from Beautifulsoup, leading to more white space. Sample test failures on Jenkins, see https://jenkins.plone.org/job/plip-plip-image-srcsets-3.8/5/#showFailuresLink

'<p>\n Go to http://www.plone.org\n</p>' != '<p>Go to http://www.plone.org</p>'
- <p>
-  Go to http://www.plone.org
? ^                          ^
+ <p>Go to http://www.plone.org</p>? ^^^                          ^^^^
- </p>

  File "/srv/python3.8/lib/python3.8/unittest/case.py", line 60, in testPartExecutor
    yield
  File "/srv/python3.8/lib/python3.8/unittest/case.py", line 676, in run
    self._callTestMethod(testMethod)
  File "/srv/python3.8/lib/python3.8/unittest/case.py", line 633, in _callTestMethod
    method()
  File "/home/jenkins/.buildout/eggs/cp38/plone.app.discussion-4.0.0a7-py3.8.egg/plone/app/discussion/tests/test_comment.py", line 180, in test_getText_doesnt_link
    self.assertEqual(
  File "/srv/python3.8/lib/python3.8/unittest/case.py", line 912, in assertEqual
    assertion_func(first, second, msg=msg)
  File "/srv/python3.8/lib/python3.8/unittest/case.py", line 1292, in assertMultiLineEqual
    self.fail(self._formatMessage(msg, standardMsg))
  File "/srv/python3.8/lib/python3.8/unittest/case.py", line 753, in fail
    raise self.failureException(msg)
mister-roboto commented 2 years ago

@mauritsvanrees thanks for creating this Pull Request and helping to improve Plone!

TL;DR: Finish pushing changes, pass all other checks, then paste a comment:

@jenkins-plone-org please run jobs

To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically.

Happy hacking!

mauritsvanrees commented 2 years ago

@jenkins-plone-org please run jobs

mauritsvanrees commented 2 years ago

Green, except for one known unstable robot test in one of the three jobs. I merge.