Skip to content

Commit

Permalink
Example to show that AccessControl currently does not work with PURE_…
Browse files Browse the repository at this point in the history
…PYTHON.

I disabled the tests which explicitly test the C implementation so only the
actually problematic ones remain.
  • Loading branch information
Michael Howitz committed Nov 29, 2021
1 parent 90ea12e commit 1ef1301
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/AccessControl/ImplPython.py
Expand Up @@ -31,7 +31,7 @@
# security implementations exist, we can switch between them later.
try:
from AccessControl.cAccessControl import _what_not_even_god_should_do
except ImportError:
except (ImportError, AttributeError):
_what_not_even_god_should_do = []

from AccessControl.interfaces import ISecurityManager
Expand Down
3 changes: 2 additions & 1 deletion src/AccessControl/tests/testSecurityManager.py
Expand Up @@ -15,7 +15,7 @@
"""

import unittest

import os

_THREAD_ID = 123

Expand Down Expand Up @@ -250,6 +250,7 @@ def _getTargetClass(self):
return SecurityManager


@unittest.skipIf(os.environ.get('PURE_PYTHON'), reason="Test expects C impl.")
class C_SecurityManagerTests(SecurityManagerTestBase,
ISecurityManagerConformance,
unittest.TestCase):
Expand Down
6 changes: 4 additions & 2 deletions src/AccessControl/tests/testZopeSecurityPolicy.py
Expand Up @@ -12,6 +12,7 @@
##############################################################################

import sys
import os
import unittest
from doctest import DocTestSuite

Expand Down Expand Up @@ -775,9 +776,10 @@ def loop():
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(Python_ZSPTests))
suite.addTest(unittest.makeSuite(C_ZSPTests))
suite.addTest(unittest.makeSuite(Python_SMTests))
suite.addTest(unittest.makeSuite(C_SMTests))
if not os.environ.get('PURE_PYTHON'):
suite.addTest(unittest.makeSuite(C_ZSPTests))
suite.addTest(unittest.makeSuite(C_SMTests))
suite.addTest(DocTestSuite())
suite.addTest(unittest.makeSuite(GetRolesWithMultiThreadTest))
return suite
3 changes: 3 additions & 0 deletions tox.ini
Expand Up @@ -19,6 +19,9 @@ deps =
setuptools < 52
zc.buildout
skip_install = true
setenv =
PURE_PYTHON=1
AC_PURE_PYTHON=1

[testenv:coverage]
basepython = python3
Expand Down

0 comments on commit 1ef1301

Please sign in to comment.