In the zope4-plip the test plone.dexterity.tests.test_utils.TestUtils.test_getAdditionalSchemata fails: http://jenkins.plone.org/view/PLIPs/job/plip-zope4/8/testReport/plone.dexterity.tests.test_utils/TestUtils/test_getAdditionalSchemata/
zope.interface has a python2/3-compatability string-class
zope.interface uses zope.interface.registry._getName is used to get a name for a nameless adapter using
But: The tests of plone.dexterity use mocker to mock stuff (adapters, behavior etc...). For a mocker-adapter without a name that does not return a string but
<mocker.Mock object at xxxxxxx> which raises an error when _compat tries to normalize it. When we force a name the test fails either when it can no longer lookup the adapter or with "Performed fewer times than expected.".
For me all the tests of plone.dexterity based on MockTestCase are totally incomprehensible. Even worse I consider them unmaintainable when a basically simple issue as the one above prevents me from fixing the tests.
Yes, it is better if you rip em out. They cause test isolation problems with plone.app.testing and/or ZopeTestCase.
We should try to get rid of this dependency since the package itself is unmaintained as far as I know. Though, I would prefer to rewrite the tests with mock or with integration tests rather than just removing them.
Thanks for this but I really think it would be better to replace these tests instead of fixing them. I don't think it takes much more time to rewrite them than to maintain them.
Fixing this by replacing mocktestcase is a huge mount of work, at least one full week for a experienced Plone developer not knowing the internals of the old tests, dexterity and whats the rational behind, a bit less for one of the in-depth core devs and much more for a beginner. I doubt this can be done w/o any funding.
I spent an hour or so on it and am about 25% done. Progress so far in the davisagli-remove-mocktestcase branch of plone.dexterity.
I'm not really changing what the tests attempt to do, but am converting it to use
mock instead of
mocker. (This is clearly the way to go since
mock is included in Python 3 as
Looks good. That's a smart way to get it done. Anyway, we should get rid of the call counts. They do not really tests anything and they make refactoring a hell. But maybe that's a different topic.
May you finish this?