summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Use zope.proxy 4.3.0 so that tests pass on Py3.issue40Jason Madden2017-09-131-9/+1
|
* 100% coverage for testing.pyJason Madden2017-09-124-46/+61
|
* 100% coverage for checker.py. Minor whitespace cleanups.Jason Madden2017-09-121-58/+67
|
* 100% coverage for proxy.pyJason Madden2017-09-122-8/+83
| | | | | | - The implementation of __getattribute__/__getattr__ now behaves like C and will not call a target's version of those functions more than once if they raise an AttributeError.
* Consistently use the correct base for super calls.Jason Madden2017-09-121-26/+26
|
* Coverage for get/setslice, length_hint, and comparison methods in proxy.pyJason Madden2017-09-122-22/+134
|
* 100% coverage for test_location.pyJason Madden2017-09-121-10/+1
| | | | zope.location is a hard test dependency, no need for conditional logic.
* 100% coverage for test_proxy.pyJason Madden2017-09-121-133/+76
| | | | | - Modern assert methods - Unify some py2/py3 tests that just depended on a method name.
* 100% coverage for test_checker.pyJason Madden2017-09-122-261/+276
| | | | | | - Modern assert methods - Whitespace cleanup - A whole test class was being skipped because of a duplicate name.
* 100% coverage for test_adapter.pyJason Madden2017-09-121-145/+83
| | | | | | - Use dict comprehensions - Use moddern self.assertIs - Unify external imports
* 100% for test_permission.pyJason Madden2017-09-121-52/+8
|
* Remove unused and broken zope.security.setup.Jason Madden2017-09-111-20/+0
|
* Remove unused internal files from tests/Jason Madden2017-09-115-162/+5
|
* 100% coverage of test_zcml_functest.pyJason Madden2017-09-111-127/+33
| | | | We have hard test dependencies, we don't need to be conditional.
* Document behaviour of ParanoidSecurityPolicy when there are no participationsissue19Jason Madden2017-09-112-15/+24
| | | | | | Add an explicit test for this case. Fixes #19.
* Merge pull request #37 from zopefoundation/issue35Jason Madden2017-09-112-0/+2
|\ | | | | call PyObject_GC_UnTrack() in tp_dealloc()
| * call PyObject_GC_UnTrack() in tp_dealloc()KIMURA Chikahiro2017-09-112-0/+2
| | | | | | | | | | | | | | | | | | see the following sites for details: * https://bugs.python.org/issue31095 * https://github.com/python/cpython/pull/2974 Fixes #35.
* | Always test watching checkers. Quiet their output to stderr.issue8Jason Madden2017-09-114-32/+65
| |
* | Fix ZOPE_WATCH_CHECKERS=1 in pure-Python mode.Jason Madden2017-09-111-20/+35
|/ | | | | | Fixes #8. Test environments still to come.
* Respect PURE_PYTHON at runtime. Partial fix for #33.issue33aJason Madden2017-09-082-9/+18
|
* Use importlib.reload instead of imp.reload.Jason Madden2017-09-082-58/+71
| | | | | | | | | | | Some minor cleanups and simplifications to test_proxy.py: - use loadTestsFromName() and wrap the conditional test in @unittest.skipIf. This gets environments closer to running the same number of tests, which helps when comparing to make sure nothing gets skipped. - Break compound assertions in test_coerce out into separate assertions for ease of reading and debuging.
* Simplify _compat.py now that we only run on newer PythonsJason Madden2017-09-0811-124/+77
| | | | | | | | | | | | | | | | | | - We have u'literals' so we don't need a _u() function. For the record the Emacs replacement regex was `_u(\(['"]\)\([^)]*\)\1) -> u\1\2\1`. Amazingly, I typed that right on the first try. A few things were only used in one (test) file or function, so it was better to keep the use, if any, local and out of the "public" api: - We can use io.StringIO everywhere and it's fast. It was only imported in one file anyway. - We can just import pickle. It was only imported in one file anyway. - TEXT was only used in one test function, `type(u'')` is just as clear (especially since the usual name is `text_type`). - reload was only used in one test function, so move the definition there.
* Merge pull request #31 from zopefoundation/issue7Jason Madden2017-09-082-31/+79
|\ | | | | Fix TypeError handling for ProxyPy.
| * Fix TypeError handling for ProxyPy.issue7Jason Madden2017-09-072-31/+79
| | | | | | | | | | | | | | Also add additional tests clarifying how the str-to-repr fallthrough works. Fixes #7
* | Allow iteration of all the custom itertools types.issue9Jason Madden2017-09-072-8/+101
| |
* | Fix issue 9: add default checkers for itertools.groupbyJason Madden2017-09-072-38/+64
|/ | | | | | | | | Also rename all the test classes in test_checker for consistency. I changed the test_suite function to not call them out by name and noticed the number of tests run dropped. At first I thought it had something to do with test class names or inheritance, so I made them all consistent. But it turned out that the manual list actually had some duplicates in it.
* Fix issue with __length_hint__ in pure Python 3. This is picked out of #29Jason Madden2017-09-071-1/+6
|
* Fix proxying of providedBy on Python 3 and fix __length_hint__Jason Madden2017-08-304-36/+219
| | | | | | | | | | | | | | | | | Fixes #27. Add special cases to defaultCheckers for the two types of objects that can be returned from zope.interface.providedBy. On Python 2, these were never proxied, but on Python 3 they were. Now it's consistent (they're never proxied). (Using an _iteratorChecker for them would be a breaking change because the results of iterating them would be security proxied interface objects that don't compare equally.) Also fix `__length_hint__` while we're at it. Previously it was ignored because it is looked up on the type of the object, and proxy didn't implement that. So implement it, and add it to the list of names allowed for iterators.
* OrderedDict, BTree and dict all iterate the same way.fix-ordered-dict-checkerJason Madden2017-05-172-29/+58
| | | | | | | | | | | Fixes #23. Also a further fix for #20 (you couldn't iterate a BTree all by itself). Refactor the test case for BTree to be a shared implementation and confirm that it works as expected for dict, using the actual dict checker. Then apply it to OrderedDict and BTree and fix the resulting failures by refactoring the fixup in checker.py to a shared implementation and applying it.
* Be specific that BTrees.keys and .values also are fixed in the same way that ↵issue20-extensionJason Madden2017-04-262-2/+9
| | | | .items was. See #20 and #21.
* Fix iteration of BTrees.items() in pure-python; and 3.6 supportJason Madden2017-04-242-7/+68
| | | | | | | | | | | | | | | Also fix ``list(proxy_btree.items())`` (or a list comprehension of the same) in Python 3, which wants the ``__len__`` for a hint. This is a central place to make sure these all behave consistently. Fixes #20 Also drop pypy3 As a 3.2 implementation, it's not supported by pip anymore. There is a much more recent version, 3.5-beta, but it's not on Travis yet. The 3.3-alpha which is on Travis is a dead end.
* Fix test failures on 64-bit WindowsMarius Gedminas2016-06-061-2/+4
| | | | | | Hopefully. Appveyor should tell me if I've succeeded. Fixes #17.
* Merge branch 'master' of https://github.com/zopefoundation/zope.security ↵Jason Madden2015-06-022-2/+2
|\ | | | | | | into pypy-support
| * Merge pull request #12 from NextThought/pypy-supportTres Seaver2015-06-021-0/+16
| |\ | | | | | | Skip the failing class-hashing tests under PyPy 2.5.0. Fixes #11.
| * | Fix 'py27-pure'/'py33-pure' tox environments.Tres Seaver2015-06-012-2/+2
| | |
* | | Make iteration over security-proxied items work under Python3 using the ↵Jason Madden2015-06-022-7/+15
| |/ |/| | | | | pure-python implementation. Fixes zopefoundation/zope.component#16.
* | Skip the failing class-hashing tests under PyPy 2.5.0. Fixes #11.Jason Madden2015-06-021-0/+16
|/
* Restore dict access of __builtins__ for non-PyPy. Interesting that it ↵Jason Madden2015-05-311-1/+4
| | | | doesn't fail interactively though.
* If the very first call to removeSecurityProxy was given a proxy, the results ↵Jason Madden2015-05-312-11/+27
| | | | would be wrong under PyPy. See zopefoundation/zope.pagetemplate#4
* Let z.s.checker.Global objects be pickled when security-proxied under PyPy ↵Jason Madden2015-05-271-3/+26
| | | | with zope.proxy 4.1.5
* Merge the two duplicated _fmt_address()Marius Gedminas2014-01-092-10/+3
|
* Try to make the tests pass on Windows, harderMarius Gedminas2014-01-081-1/+1
| | | | | Judging from http://winbot.zope.org/builders/zope.security_py_265_32/builds/1107/steps/test/logs/stdio the address is generated using upper-case hex digits.
* Typo in comment, PEP-8 spacing around assignmentMarius Gedminas2014-01-081-2/+2
|
* Allow public access to CheckerPublic.__module__Marius Gedminas2014-01-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Story time: when you pickle an object (call it obj) with a custom __reduce__ method that returns a string, the pickle module assumes this is a global and wants to know which module it came from. It obviously tries obj.__module__ first, but if that raises AttributeError, it has this insane fallback loop where it iterates over sys.modules.items() and for each module (excepting only __main__) checks if getattr(module, obj.__name__, None) is obj. Before my change if you tried >>> from zope.security.checker import CheckerPublic >>> CheckerPublic.__module__ you'd get ForbiddenAttribute: ('__module__', Global(CheckerPublic,zope.security.checker)) Until now it was just a silly inefficiency. But then six 1.5.0 was released with an interesting change: https://bitbucket.org/gutworth/six/commits/fc2decf405ea6bcd3226bb1b77069d2a2279e0b7 Now six puts these six.MovedModule() wrappers into sys.modules. When you try to access their attributes, the wrappers try to import random modules, including those that may not exist in your Python (_winreg on Linux? _tkinter also is often split off into a separate OS package). Boom: running zope.security's tests now fails in random ways: https://bitbucket.org/gutworth/six/issue/54/dependency-on-optional-tkinter-gdbm So let's make sure pickle doesn't need to iterate through sys.modules.items() and avoid the issue, m'kay?
* Fix typo in docstringMarius Gedminas2013-03-271-1/+1
|
* Bugfix: ZOPE_WATCH_CHECKERS=1 used to miss most of the checksMarius Gedminas2013-03-272-0/+14
|
* Fix a long-standing bug with ZOPE_WATCH_CHECKERS=2Marius Gedminas2013-03-272-1/+11
|
* Add test environments for the PURE_PYTHON environment variable.Tres Seaver2013-03-111-1/+5
| | | | Get the one test which failed under that environment to pass.
* - Make sure that __str__ and __repr__ never fail by catching all exceptionsStephan Richter2013-03-115-15/+22
| | | | | | | | | | | | | | | and using the custom fallback. (This is equivalent to the C Proxy behavior.) - Allow __getslice__ and __setslice__ to access the original object's implementation instead of always falling back to __getitem__ and __setitem__. Do we really want to support this or just remove the test? (It is deprecated this Python 2.0!) - Make sure that Checker.set_permissions is set initiated as an empty dict, if not provided. While not immediately obvious, this is the C-based checker behavior as well. Oh yeah, all tests pass now on py26, py27, py32, py33, and pypy!
* Changed strategy to hide wrapped to not use the secret anymore, but lookStephan Richter2013-03-114-59/+80
| | | | | | | | | | at the frames. This fixes a bunch of issues when actually doing binary ops (for which I added a test now). __len__ must return a non-proxied object, so I added a new parameter to the name check wrapper to handle that case. Fixed all but 12 test failures on PyPy.