Skip to content

Commit

Permalink
Test fix: remove deprecated ustring handling, which is only needed on…
Browse files Browse the repository at this point in the history
… Python 2.

Part of plone/Products.CMFPlone#3305
  • Loading branch information
mauritsvanrees committed Dec 20, 2021
1 parent ee11ea2 commit b361328
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 20 deletions.
2 changes: 2 additions & 0 deletions news/3305.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Test fix: remove deprecated ustring handling, which is only needed on Python 2.
[maurits]
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,5 @@ form::
>>> browser.getControl('Cancel').click()
>>> 'Changes canceled.' in browser.contents
True
>>> import six
>>> searchstring = '?userid:utf8:ustring=test_user_1_' if six.PY2 else '?userid=test_user_1_'
>>> searchstring in browser.url
>>> '?userid=test_user_1_' in browser.url
True
13 changes: 0 additions & 13 deletions plone/app/users/tests/test_doctests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
from plone.testing import layered

import doctest
import re
import six
import unittest


Expand All @@ -30,16 +28,6 @@
)


class Py23DocChecker(doctest.OutputChecker):
def check_output(self, want, got, optionflags):
if six.PY2:
got = got.replace('Unauthorized', 'zExceptions.unauthorized.Unauthorized')
got = got.replace(':utf8:ustring', '')
got = re.sub("u'(.*?)'", "'\\1'", got)
want = re.sub("b'(.*?)'", "'\\1'", want)
return doctest.OutputChecker.check_output(self, want, got, optionflags)


def test_suite():
suite = unittest.TestSuite()
suite.addTests([
Expand All @@ -48,7 +36,6 @@ def test_suite():
'tests/{0}'.format(test_file),
package='plone.app.users',
optionflags=optionflags,
checker=Py23DocChecker(),
),
layer=PLONE_APP_USERS_FUNCTIONAL_TESTING)
for test_file in doc_tests
Expand Down
4 changes: 0 additions & 4 deletions plone/app/users/tests/userdata_prefs_user_details.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ Set Up
>>> membership = portal.portal_membership

>>> user_information_url = 'http://nohost/plone/@@user-information?userid={0}'.format(TEST_USER_ID)
>>> import six
>>> if six.PY2:
... user_information_url = 'http://nohost/plone/@@user-information?userid:utf8:ustring=test_user_1_'

>>> browser = Browser(app)
>>> browser.handleErrors = False

Expand Down

0 comments on commit b361328

Please sign in to comment.