summaryrefslogtreecommitdiff
path: root/src/zope/interface/tests
Commit message (Collapse)AuthorAgeFilesLines
* Fix coverage.issue126Jason Madden2018-10-231-2/+2
|
* Fix 'verifyObject' for class objects with staticmethods on Python 3.Jason Madden2018-10-231-0/+21
| | | | Fixes #126
* Allow Registering and unregistering instance methods as listeners (#102)‮rekcäH nitraM‮2017-11-281-0/+11
| | | * Fixes #12 - registering instance methods as listeners doesn’t allow to easily unregister them as the registry tries to find the handler with 'is' but it should use '==' to allow the python BoundMethod wrapper (which is a new instance every time instance.$methodname is accessed).
* Drop __annotations__ in interface declarationsMaxim Avanov2017-09-011-0/+9
|
* Merge pull request #95 from zopefoundation/combined-coverageJason Madden2017-06-147-38/+46
|\ | | | | Enable combined coverage reports under tox and branch coverage
| * cleanups requested by @tseaver: remove assert from _implements since all its ↵Jason Madden2017-06-141-2/+5
| | | | | | | | callers already do this guard; be more explicit about ClassType in test_odd_declarations
| * Enable combined coverage reports under tox and branch coveragecombined-coverageJason Madden2017-06-147-37/+42
| | | | | | | | | | | | | | | | Fixes #91 Remove many (or most) now-redundant 'pragma: no cover'. A few minor test changes to get full branch coverage.
* | Fix the cache getting out of sync with _utility_registrations.issue93Jason Madden2017-06-141-0/+53
|/ | | | Fixes #93
* Fix #85 by implementing __reduce__ to omit _v_ attributes.issue85-take2-reduceJason Madden2017-06-141-1/+102
| | | | | | | | | | This is an alternative to #86 and was suggested by @mgedmin in #85. There are tests to be sure this works for subclasses like Pyramid's Registry that extend dict too. This doesn't change the pickle format, we were storing the output of object.__reduce__ previously.
* 100% coverage (#90)Jason Madden2017-06-129-240/+165
| | | | | | | | | | | | | | | | | | | | | * Get as close to 100% coverage as possible. Without conflicting with #86. This is almost entirely trivial changes: - Make dummy methods that should never be called either raise NotImplementedError or call self.fail() in tests. - Standardize the no-coverage pragma - Add a few pragmas where coverage varies across versions/implementations, mostly for the sake of tox (travis should hit them all). * Convert tox to run the coverage command, like travis. A follow up should have it produce coverage for all python versions/implementations. Fixes #87 * Adjust coverage config for py2 only tests; fix typo; finish replacing self with cls
* Test sanity cleanups (#88)Jason Madden2017-06-0813-179/+89
| | | | | | | | | | | | | | | | | | | * Test sanity cleanups Partially addresses #87 - Remove manual lists of tests in favor of loadTestsFromName. This mostly gets all test runners running the same number of tests. - Remove `additional_tests`, which was just duplicating the discovered tests. No modern test runner seems to need it. - Change the two compatibility skip decorators to actually use unitetest skips, which helps with the reporting. * Per @tseaver, drop most test_suite functions. * Port remaining doctest to unittest. * Make the odd tests work on all supported python versions
* Simply the caching of utility-registration data. In addition toJim Fulton2017-05-121-2/+0
| | | | | simplification, avoids spurious test failures when checking for leaks in tests with persistent registries.
* Raise ValueError if non-text name passed to adapter registry methods.75-prevent-non-text-name-errorsTres Seaver2017-05-041-0/+32
| | | | | | Prevents corruption of lookup cache. Alternative to fix proposed in #75.
* Add tests asserting that optimzations are / are not present as expected.Tres Seaver2016-11-153-0/+103
|
* Fix equality testing of implementedBy objects that have been proxied. Fixes #55.fix-55Jason Madden2016-09-021-0/+40
|
* Support Components subclasses that are not hashable. (#54)Jason Madden2016-08-311-6/+16
| | | | | * Support Components subclasses that are not hashable. Fixes #53.
* Use dictionary lookups for testing subscribed status.Jason Madden2016-08-191-50/+140
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #46. Benchmarks show a dramatic improvement; not quite as good as the demonstration in #46 because the implementation had to be a bit more complex to properly handle unregistration, but still very good. Here it is with 20,000 items already registered: ``` %time add_to_reg(reg, 1000) CPU times: user 190 ms, sys: 19.3 ms, total: 209 ms Wall time: 203 ms ``` Here's a profile with about 100,000 utilities registered: ``` %prun add_to_reg(reg, 1000) 80005 function calls (79005 primitive calls) in 0.713 seconds Ordered by: internal time ncalls tottime percall cumtime percall filename:lineno(function) 1000 0.596 0.001 0.621 0.001 adapter.py:202(subscribe) 12000 0.016 0.000 0.019 0.000 interface.py:518(__hash__) 1000 0.010 0.000 0.709 0.001 registry.py:206(registerUtility) 3000/2000 0.009 0.000 0.014 0.000 interface.py:255(interfaces) 2000 0.008 0.000 0.022 0.000 adapter.py:637(changed) 1000 0.008 0.000 0.025 0.000 registry.py:498(_getUtilityProvided) 9000 0.008 0.000 0.017 0.000 {method 'get' of 'dict' objects} 1000 0.008 0.000 0.027 0.000 adapter.py:102(register) 2000 0.006 0.000 0.008 0.000 adapter.py:450(changed) 1000 0.005 0.000 0.663 0.001 registry.py:145(registerUtility) ``` I was very careful not to change the pickle at all. zope.interface and zope.component tests have been run and both pass. (It was necessary to account for the underlying objects changing because of the way zope.component cleans up after tests.)
* Make declarations.Implements sortable.comp-implementsJason Madden2016-08-032-4/+22
| | | | Fixes #42
* Remove the _u compat function.literalsJason Madden2016-08-024-192/+192
| | | | | | Since we no longer support 3.2 we can use the literal syntax. This was done with a quick sed script.
* Remove deprecated unittest assertions.Tres Seaver2014-12-277-741/+668
|
* 100% branch coverage for 'zope.interface.ro'.Tres Seaver2014-12-081-0/+115
|
* 100% branch coverage for 'zope.interface.registry'.Tres Seaver2014-12-081-15/+94
|
* 100% branch coverage for 'zope.interface.interface'.Tres Seaver2014-12-081-23/+45
|
* 100% branch coverage for 'zope.interface.declarations'.Tres Seaver2014-12-081-3/+5
|
* 100% branch coverage for 'zope.interface.adapter'.Tres Seaver2014-12-081-7/+109
|
* Changed name to asReStructuredText for CamelCase correctness.Michael McNeil Forbes2014-10-301-15/+15
|
* Added new function asreStructuredTest to keep backward compatibilityMichael McNeil Forbes2014-10-291-11/+237
| | | | | - To keep code clean, functionality is implemented in asStructuredText with an added flag rst with default value False to preserve behaviour.
* Updated tests.Michael McNeil Forbes2014-10-291-24/+24
|
* Added ``@named(name)`` declaration.Stephan Richter2014-02-042-7/+79
| | | | | | | The decorator specifies the component name, so it does not have to be passed in during registration. This in turn allows developers to define component names once globally and use it everywhere, especially when using ZCML where the name had to be specified a second time.
* Fixed a verifyClass false positive with a decorated method.Albertas Agejevas2013-02-281-0/+23
| | | | | This bug was a reason (?) for a gratuitous fork of the _verify function in z3c.testing.verify.
* - LP #1055223: Fix test which depended on dictionary order and failed randomlyBrian Sutherland2012-09-281-2/+2
| | | | | in Python 3.3.
* Drop explicit DeprecationWarnings for "class advice" APISTres Seaver2012-05-221-19/+9
| | | | | | | These APIs are still deprecated under Python 2.x, and still raise an exception under Python 3.x, but no longer cause a warning to be emitted under Python 2.x.
* further simplify some attribute lookupsFred Drake2012-04-061-1/+1
|
* Drop unneeded compatibility shims for method / function attributes.Tres Seaver2012-04-061-2/+1
| | | | | '__code__', '__defaults__', '__func__', and '__self__' all work fine on Python 2.6+.
* Deprecated the "class advice" APIs from ``zope.interface.declarations``.Tres Seaver2012-04-061-38/+78
| | | | | | | | | Code which uses the deprecated APIs will not work as expected under Py3k. Instead of ``implements``, ``implementsOnly``, or ``classProvides``, prefer the equivalent class decorators: ``@implementer``, ``@implementer_only``, and ``@provider``.
* Re-silence Py3k whines.Tres Seaver2012-04-061-31/+44
|
* Close Py3k coverage gap to absolute minimum.Tres Seaver2012-04-062-12/+158
| | | | | We *can't* test the classAdvice stuff under Py3k. Need to deprecate it before the 4.0 release.
* Coverage under Py3k.Tres Seaver2012-04-061-4/+0
|
* 100% coverage under Python 2.x.Tres Seaver2012-04-061-0/+67
|
* Guard against possible failure under hash-randomizing Pythons.Tres Seaver2012-04-051-2/+2
|
* Silence Py3k whining.Tres Seaver2012-04-053-16/+16
|
* Restore 'adapter_hooks' after patching for test purposes.Tres Seaver2012-04-051-3/+7
|
* The C impl. caches BuiltinImmplentationSpecifications too early.Tres Seaver2012-04-051-12/+33
| | | | | So, we need to monkey-patch its contents, rather than stuff a new dict into the module.
* Merge Py3k w/o 2to3 work.Tres Seaver2012-04-047-220/+316
|
* Merge from LP branch.Tres Seaver2012-03-2615-2529/+8095
|
* Merge chrism-componentregistry branch: Chris McDonough2011-09-151-0/+950
| | | | | svn merge -r122752:122809 svn+ssh://svn.zope.org/repos/main/zope.interface/branches/chrism-componentregistry
* Fix test failure under 'python setup.py test' in new test for '__hash__'.Tres Seaver2011-08-121-0/+2
| | | | | Fixes LP #825249.
* Fix Python 2.5 incompatibility introduced in new tests of ``__hash__``.Tres Seaver2011-08-121-1/+6
|
* Work around buggy behavior in some subclasses of `InterfaceClass``Tres Seaver2011-08-112-8/+55
| | | | | | | | | Some sublcasses invoke '__hash__' before initializing '__module__' and '__name__'. The workaround returns a fixed constant hash in such cases, and issues a UserWarning. Addresses LP #811792.
* - Fix testing deprecation warnings issued when tested under Py3K.Chris McDonough2011-07-213-70/+88
|