diff options
author | Jason Madden <jamadden@gmail.com> | 2017-06-29 12:44:25 -0500 |
---|---|---|
committer | Jason Madden <jamadden@gmail.com> | 2017-06-30 11:01:09 -0500 |
commit | 712bb8e078de20e01311cfe57d8dccfbbdcbe9b3 (patch) | |
tree | 4cb7d4e9cc901fe144d168b77eea235a08932787 /docs | |
parent | 43d7351318eb373d1f4f500b70e4e461048c16f4 (diff) | |
download | zope-component-issue29.tar.gz |
100% coverageissue29
Add change note and badge to readme.
Remove unused class and function.
Omit standalonetests.py entirely from coverage.
Another unused class.
Incorporate feedback in test__api.py
* Bring back _callFUT and make the queryAdapterInContext tests call it
* Change raise NotImplentedError into specific fails_if_called() calls.
Remove redundant argument now that all test in Test_adapts pass under all versions.
Remove NotImplementedError from test_globalregistry.py
Remove NotImplementedError from test_hookable.py
Remove NotImplementedError from test_registry.py
Remove NotImplementedError from test_security.py
Remove NotImplementedError from test_zcml.py
Remove NotImplementedError from test_factory.py
Document ZCML feature and devmode.
Really accept all arguments unless opted out.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/testlayer.rst | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/docs/testlayer.rst b/docs/testlayer.rst index 98dc96c..b0bf6b7 100644 --- a/docs/testlayer.rst +++ b/docs/testlayer.rst @@ -76,6 +76,11 @@ ZCMLLayer We now want a layer that loads up some ZCML from a file. The default is ``ftesting.zcml``, but here we'll load a test ``testlayer.zcml``. +We can also choose to provide extra ZCML features that are used `to +conditionally control processing of certain directives +<http://zopeconfiguration.readthedocs.io/en/latest/narr.html#making-specific-directives-conditional>`_ +(here we use "devmode", a common condition for controlling development +options like debugging output). .. doctest:: @@ -83,17 +88,21 @@ is ``ftesting.zcml``, but here we'll load a test ``testlayer.zcml``. >>> import zope.component.testfiles >>> zcml_file_layer = ZCMLFileLayer( ... zope.component.testfiles, - ... 'testlayer.zcml') + ... 'testlayer.zcml', + ... features=["devmode"]) >>> class TestCase(unittest.TestCase): ... layer = zcml_file_layer ... ... def testFoo(self): + ... # The feature was registered + ... self.assertTrue(self.layer.context.hasFeature('devmode')) ... # we should now have the adapter registered ... from zope import component ... from zope.component.testfiles import components - ... self.assert_(isinstance( - ... components.IApp2(components.content), components.Comp2)) + ... self.assertIsInstance( + ... components.IApp2(components.content), components.Comp2) + Since the ZCML sets up an adapter, we expect the tests to pass: |