-
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fc] Repository: plone.app.relationfield
Branch: refs/heads/master Date: 2018-06-27T09:47:26+02:00 Author: Philip Bauer (pbauer) <bauer@starzel.de> Commit: plone/plone.app.relationfield@11cca7a fix tests in py3 Files changed: M plone/app/relationfield/marshaler.py M plone/app/relationfield/marshaler.rst M plone/app/relationfield/supermodel.txt M plone/app/relationfield/tests/test_supermodel.py Repository: plone.app.relationfield Branch: refs/heads/master Date: 2018-09-19T15:35:54+02:00 Author: Philip Bauer (pbauer) <bauer@starzel.de> Commit: plone/plone.app.relationfield@7c1c1ad add changenote and classifiers Files changed: M CHANGES.rst M setup.py Repository: plone.app.relationfield Branch: refs/heads/master Date: 2018-09-19T16:53:36+02:00 Author: Philip Bauer (pbauer) <bauer@starzel.de> Commit: plone/plone.app.relationfield@c0ba587 Merge pull request #24 from plone/python3 fix tests in py3 Files changed: M CHANGES.rst M plone/app/relationfield/marshaler.py M plone/app/relationfield/marshaler.rst M plone/app/relationfield/supermodel.txt M plone/app/relationfield/tests/test_supermodel.py M setup.py
- Loading branch information
Showing
1 changed file
with
46 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,56 @@ | ||
Repository: plone.recipe.alltests | ||
Repository: plone.app.relationfield | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2018-09-19T14:46:51+02:00 | ||
Date: 2018-06-27T09:47:26+02:00 | ||
Author: Philip Bauer (pbauer) <bauer@starzel.de> | ||
Commit: https://github.com/plone/plone.recipe.alltests/commit/109fd70346d6daade54d8a4b9d30099d8124b239 | ||
Commit: https://github.com/plone/plone.app.relationfield/commit/11cca7a739712ea6af89e96c3f22958d781b6f05 | ||
|
||
add classifiers | ||
fix tests in py3 | ||
|
||
Files changed: | ||
M plone/app/relationfield/marshaler.py | ||
M plone/app/relationfield/marshaler.rst | ||
M plone/app/relationfield/supermodel.txt | ||
M plone/app/relationfield/tests/test_supermodel.py | ||
|
||
b'diff --git a/plone/app/relationfield/marshaler.py b/plone/app/relationfield/marshaler.py\nindex 10965f2..00d221a 100644\n--- a/plone/app/relationfield/marshaler.py\n+++ b/plone/app/relationfield/marshaler.py\n@@ -2,6 +2,8 @@\n from plone.rfc822.defaultfields import BaseFieldMarshaler\n from z3c.relationfield import RelationValue\n \n+import six\n+\n \n class RelationFieldMarshaler(BaseFieldMarshaler):\n """Field marshaler for z3c.relationfield IRelation and IRelationChoice\n@@ -23,8 +25,10 @@ def decode(\n contentType=None,\n primary=False,\n ):\n+ if isinstance(value, six.binary_type):\n+ value = value.decode(charset)\n try:\n- toId = int(value.decode(charset))\n+ toId = int(value)\n except TypeError as e:\n raise ValueError(e)\n return RelationValue(toId)\ndiff --git a/plone/app/relationfield/marshaler.rst b/plone/app/relationfield/marshaler.rst\nindex cc3a652..41a56fc 100644\n--- a/plone/app/relationfield/marshaler.rst\n+++ b/plone/app/relationfield/marshaler.rst\n@@ -18,9 +18,9 @@ this test, we don\'t bother creating actual relations in the relationship\n catalog. All we care about is the \'to_id\' variable.\n \n >>> from z3c.relationfield import RelationValue\n- >>> from zope.interface import implements\n- >>> class TestContent(object):\n- ... implements(ITestContent)\n+ >>> from zope.interface import implementer\n+ >>> @implementer(ITestContent)\n+ ... class TestContent(object):\n ... _relation = RelationValue(123)\n ... _relationChoice = RelationValue(234)\n ... _relationList = [RelationValue(345), RelationValue(456)]\ndiff --git a/plone/app/relationfield/supermodel.txt b/plone/app/relationfield/supermodel.txt\nindex 240d101..50e8c3d 100644\n--- a/plone/app/relationfield/supermodel.txt\n+++ b/plone/app/relationfield/supermodel.txt\n@@ -69,7 +69,7 @@ The field factory for relation fields should tell us this is editable::\n And, we should have our specified portal_type spec::\n \n >>> schema[\'my_rc\'].source.query.get(\'portal_type\')\n- [u\'Folder\', u\'File\']\n+ [\'Folder\', \'File\']\n \n The second test field has an empty portal_type stanza. It should look much\n like the first example, but with no types.\n@@ -103,7 +103,7 @@ last field. That\'s because we are not supporting export of explicit sources.\n Serialization::\n \n >>> from plone.supermodel import serializeModel\n- >>> print serializeModel(model)\n+ >>> print(serializeModel(model))\n <model ...>\n <schema>\n <field name="my_rc" type="z3c.relationfield.schema.RelationChoice">\n@@ -168,7 +168,7 @@ We just need to make sure it\'s handled in the value_type::\n [\'my_rl\']\n \n >>> schema[\'my_rl\'].value_type.source.query.get(\'portal_type\')\n- [u\'Folder\', u\'File\']\n+ [\'Folder\', \'File\']\n \n >>> factory_utility.editable(schema[\'my_rl\'])\n True\n@@ -177,7 +177,7 @@ Export\n ------\n \n >>> from plone.supermodel import serializeModel\n- >>> print serializeModel(model)\n+ >>> print(serializeModel(model))\n <model ...>\n <schema>\n <field name="my_rl" type="z3c.relationfield.schema.RelationList">\ndiff --git a/plone/app/relationfield/tests/test_supermodel.py b/plone/app/relationfield/tests/test_supermodel.py\nindex 5fbaab1..ccd6900 100644\n--- a/plone/app/relationfield/tests/test_supermodel.py\n+++ b/plone/app/relationfield/tests/test_supermodel.py\n@@ -4,6 +4,8 @@\n \n import doctest\n import os\n+import re\n+import six\n import unittest\n \n \n@@ -11,13 +13,23 @@\n doctest.NORMALIZE_WHITESPACE)\n \n \n+class Py23DocChecker(doctest.OutputChecker):\n+ def check_output(self, want, got, optionflags):\n+ if six.PY2:\n+ got = re.sub("u\'(.*?)\'", "\'\\\\1\'", got)\n+ return doctest.OutputChecker.check_output(self, want, got, optionflags)\n+\n+\n def test_suite():\n suite = unittest.TestSuite()\n suite.addTests([\n- layered(doctest.DocFileSuite(\n+ layered(\n+ doctest.DocFileSuite(\n os.path.join(os.path.pardir, \'supermodel.txt\'),\n- optionflags=optionflags),\n- FUNCTIONAL_WIDGETS_TESTING)\n+ optionflags=optionflags,\n+ checker=Py23DocChecker(),\n+ ),\n+ layer=FUNCTIONAL_WIDGETS_TESTING)\n ])\n return suite\n \n' | ||
|
||
Repository: plone.app.relationfield | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2018-09-19T15:35:54+02:00 | ||
Author: Philip Bauer (pbauer) <bauer@starzel.de> | ||
Commit: https://github.com/plone/plone.app.relationfield/commit/7c1c1ad0c70fdcd52e1c5e7ba35fc1e6dbac0b47 | ||
|
||
add changenote and classifiers | ||
|
||
Files changed: | ||
M CHANGES.rst | ||
M setup.py | ||
|
||
b'diff --git a/CHANGES.rst b/CHANGES.rst\nindex b004511..145e2c8 100644\n--- a/CHANGES.rst\n+++ b/CHANGES.rst\n@@ -17,6 +17,9 @@ Bug fixes:\n - Change import of message factory from dx to non-deprecated way.\n [jensens]\n \n+- Fix tests in py3\n+ [pbauer]\n+\n \n 1.4.1 (2018-06-19)\n ------------------\ndiff --git a/setup.py b/setup.py\nindex f25447b..1ebb5fe 100644\n--- a/setup.py\n+++ b/setup.py\n@@ -17,9 +17,12 @@\n \'Framework :: Plone\',\n \'Framework :: Plone :: 5.0\',\n \'Framework :: Plone :: 5.1\',\n+ \'Framework :: Plone :: 5.2\',\n "License :: OSI Approved :: GNU General Public License (GPL)",\n \'Programming Language :: Python\',\n \'Programming Language :: Python :: 2.7\',\n+ \'Programming Language :: Python :: 3.6\',\n+ \'Programming Language :: Python :: 3.7\',\n \'Topic :: Software Development :: Libraries :: Python Modules\',\n ],\n keywords=\'dexterity relations plone zc.relation\',\n' | ||
|
||
Repository: plone.app.relationfield | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2018-09-19T16:53:36+02:00 | ||
Author: Philip Bauer (pbauer) <bauer@starzel.de> | ||
Commit: https://github.com/plone/plone.app.relationfield/commit/c0ba587b01a5844c06a47885353c1039bb4ee614 | ||
|
||
Merge pull request #24 from plone/python3 | ||
|
||
fix tests in py3 | ||
|
||
Files changed: | ||
M CHANGES.rst | ||
M plone/app/relationfield/marshaler.py | ||
M plone/app/relationfield/marshaler.rst | ||
M plone/app/relationfield/supermodel.txt | ||
M plone/app/relationfield/tests/test_supermodel.py | ||
M setup.py | ||
|
||
b'diff --git a/setup.py b/setup.py\nindex cf0f590..f32273b 100644\n--- a/setup.py\n+++ b/setup.py\n@@ -29,10 +29,13 @@ def read(*rnames):\n "Framework :: Plone :: 4.3",\n "Framework :: Plone :: 5.0",\n "Framework :: Plone :: 5.1",\n+ "Framework :: Plone :: 5.2",\n "Framework :: Zope2",\n "Programming Language :: Python",\n "Programming Language :: Python :: 2.6",\n "Programming Language :: Python :: 2.7",\n+ "Programming Language :: Python :: 3.6",\n+ "Programming Language :: Python :: 3.7",\n ],\n tests_require=[\'zope.testing\'],\n packages=find_packages(\'src\'),\n' | ||
b'diff --git a/CHANGES.rst b/CHANGES.rst\nindex b004511..145e2c8 100644\n--- a/CHANGES.rst\n+++ b/CHANGES.rst\n@@ -17,6 +17,9 @@ Bug fixes:\n - Change import of message factory from dx to non-deprecated way.\n [jensens]\n \n+- Fix tests in py3\n+ [pbauer]\n+\n \n 1.4.1 (2018-06-19)\n ------------------\ndiff --git a/plone/app/relationfield/marshaler.py b/plone/app/relationfield/marshaler.py\nindex 10965f2..00d221a 100644\n--- a/plone/app/relationfield/marshaler.py\n+++ b/plone/app/relationfield/marshaler.py\n@@ -2,6 +2,8 @@\n from plone.rfc822.defaultfields import BaseFieldMarshaler\n from z3c.relationfield import RelationValue\n \n+import six\n+\n \n class RelationFieldMarshaler(BaseFieldMarshaler):\n """Field marshaler for z3c.relationfield IRelation and IRelationChoice\n@@ -23,8 +25,10 @@ def decode(\n contentType=None,\n primary=False,\n ):\n+ if isinstance(value, six.binary_type):\n+ value = value.decode(charset)\n try:\n- toId = int(value.decode(charset))\n+ toId = int(value)\n except TypeError as e:\n raise ValueError(e)\n return RelationValue(toId)\ndiff --git a/plone/app/relationfield/marshaler.rst b/plone/app/relationfield/marshaler.rst\nindex cc3a652..41a56fc 100644\n--- a/plone/app/relationfield/marshaler.rst\n+++ b/plone/app/relationfield/marshaler.rst\n@@ -18,9 +18,9 @@ this test, we don\'t bother creating actual relations in the relationship\n catalog. All we care about is the \'to_id\' variable.\n \n >>> from z3c.relationfield import RelationValue\n- >>> from zope.interface import implements\n- >>> class TestContent(object):\n- ... implements(ITestContent)\n+ >>> from zope.interface import implementer\n+ >>> @implementer(ITestContent)\n+ ... class TestContent(object):\n ... _relation = RelationValue(123)\n ... _relationChoice = RelationValue(234)\n ... _relationList = [RelationValue(345), RelationValue(456)]\ndiff --git a/plone/app/relationfield/supermodel.txt b/plone/app/relationfield/supermodel.txt\nindex 240d101..50e8c3d 100644\n--- a/plone/app/relationfield/supermodel.txt\n+++ b/plone/app/relationfield/supermodel.txt\n@@ -69,7 +69,7 @@ The field factory for relation fields should tell us this is editable::\n And, we should have our specified portal_type spec::\n \n >>> schema[\'my_rc\'].source.query.get(\'portal_type\')\n- [u\'Folder\', u\'File\']\n+ [\'Folder\', \'File\']\n \n The second test field has an empty portal_type stanza. It should look much\n like the first example, but with no types.\n@@ -103,7 +103,7 @@ last field. That\'s because we are not supporting export of explicit sources.\n Serialization::\n \n >>> from plone.supermodel import serializeModel\n- >>> print serializeModel(model)\n+ >>> print(serializeModel(model))\n <model ...>\n <schema>\n <field name="my_rc" type="z3c.relationfield.schema.RelationChoice">\n@@ -168,7 +168,7 @@ We just need to make sure it\'s handled in the value_type::\n [\'my_rl\']\n \n >>> schema[\'my_rl\'].value_type.source.query.get(\'portal_type\')\n- [u\'Folder\', u\'File\']\n+ [\'Folder\', \'File\']\n \n >>> factory_utility.editable(schema[\'my_rl\'])\n True\n@@ -177,7 +177,7 @@ Export\n ------\n \n >>> from plone.supermodel import serializeModel\n- >>> print serializeModel(model)\n+ >>> print(serializeModel(model))\n <model ...>\n <schema>\n <field name="my_rl" type="z3c.relationfield.schema.RelationList">\ndiff --git a/plone/app/relationfield/tests/test_supermodel.py b/plone/app/relationfield/tests/test_supermodel.py\nindex 5fbaab1..ccd6900 100644\n--- a/plone/app/relationfield/tests/test_supermodel.py\n+++ b/plone/app/relationfield/tests/test_supermodel.py\n@@ -4,6 +4,8 @@\n \n import doctest\n import os\n+import re\n+import six\n import unittest\n \n \n@@ -11,13 +13,23 @@\n doctest.NORMALIZE_WHITESPACE)\n \n \n+class Py23DocChecker(doctest.OutputChecker):\n+ def check_output(self, want, got, optionflags):\n+ if six.PY2:\n+ got = re.sub("u\'(.*?)\'", "\'\\\\1\'", got)\n+ return doctest.OutputChecker.check_output(self, want, got, optionflags)\n+\n+\n def test_suite():\n suite = unittest.TestSuite()\n suite.addTests([\n- layered(doctest.DocFileSuite(\n+ layered(\n+ doctest.DocFileSuite(\n os.path.join(os.path.pardir, \'supermodel.txt\'),\n- optionflags=optionflags),\n- FUNCTIONAL_WIDGETS_TESTING)\n+ optionflags=optionflags,\n+ checker=Py23DocChecker(),\n+ ),\n+ layer=FUNCTIONAL_WIDGETS_TESTING)\n ])\n return suite\n \ndiff --git a/setup.py b/setup.py\nindex f25447b..1ebb5fe 100644\n--- a/setup.py\n+++ b/setup.py\n@@ -17,9 +17,12 @@\n \'Framework :: Plone\',\n \'Framework :: Plone :: 5.0\',\n \'Framework :: Plone :: 5.1\',\n+ \'Framework :: Plone :: 5.2\',\n "License :: OSI Approved :: GNU General Public License (GPL)",\n \'Programming Language :: Python\',\n \'Programming Language :: Python :: 2.7\',\n+ \'Programming Language :: Python :: 3.6\',\n+ \'Programming Language :: Python :: 3.7\',\n \'Topic :: Software Development :: Libraries :: Python Modules\',\n ],\n keywords=\'dexterity relations plone zc.relation\',\n' | ||
|