[zope2-tracker] [Bug 1169923] Re: ImplPython initialisation is also required for ImplC

Arnaud Fontaine 1169923 at bugs.launchpad.net
Tue Jul 2 13:45:14 CEST 2013


Thank you very much for the unit test.

When my patch is not applied, I get the following error:
$ python setup.py test -s AccessControl.tests.testZopeSecurityPolicy.C_SMTests
test__ownerous_and__authenticated_after_updating_defaults (AccessControl.tests.testZopeSecurityPolicy.C_SMTests) ... FAIL
test__ownerous_and__authenticated_defaults (AccessControl.tests.testZopeSecurityPolicy.C_SMTests) ... ok
======================================================================
FAIL: test__ownerous_and__authenticated_after_updating_defaults (AccessControl.tests.testZopeSecurityPolicy.C_SMTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/src/erp5/src/AccessControl/src/AccessControl/tests/testZopeSecurityPolicy.py", line 476, in test__ownerous_and__authenticated_after_updating_defaults
    self.assertTrue(mgr.checkPermission('testing', object()))
AssertionError: 0 is not true
----------------------------------------------------------------------
Ran 2 tests in 0.001s

Whereas AccessControl.tests.testZopeSecurityPolicy.Python_SMTests test
suite passes. With my patch is applied, both test suites pass.

However, when running 'test_suite' (through 'python setup.py test -m
AccessControl.tests.testZopeSecurityPolicy'), first Python
Implementation test suite is executed. Then, when C Implementation test
suite is executed, it fails because _ImplPython._defaultPolicy still
points to Python Implementation ZopeSecurityPolicy (as set by
AccessControl.SecurityManager.setSecurityPolicy()), thus when
SecurityManager class is instanciated, it wrongly uses
ImplPython._defaultPolicy . I have attached a patch on top of your test
to fix this issue.

BTW, should I merge your unit test (and the fix I did if you think
that's ok) into my commit and add a Signed-off-by with your name?


** Patch added: "AccessControl_reset_test_Implementation.patch"
   https://bugs.launchpad.net/zope2/+bug/1169923/+attachment/3721718/+files/AccessControl_reset_test_Implementation.patch

-- 
You received this bug notification because you are a member of Zope 2
Developers, which is subscribed to Zope 2.
https://bugs.launchpad.net/bugs/1169923

Title:
  ImplPython initialisation is also required for ImplC

To manage notifications about this bug go to:
https://bugs.launchpad.net/zope2/+bug/1169923/+subscriptions


More information about the zope2-tracker mailing list