Skip to content

Commit

Permalink
Refactor tests so functional tests are now also discovered by tox, tr…
Browse files Browse the repository at this point in the history
…avis runs
  • Loading branch information
gyst committed Jan 11, 2018
1 parent e4ae2df commit 5bccf1c
Show file tree
Hide file tree
Showing 181 changed files with 134 additions and 129 deletions.
6 changes: 3 additions & 3 deletions src/grokcore/view/ftesting.zcml
Expand Up @@ -34,7 +34,7 @@
<role id="grok.BoneOwner" title="Bone Owner" />
<grant role="grok.BoneOwner" permission="bone.gold" />

<grok:grok package="grokcore.view.ftests" />
<grok:grok package="grokcore.view.tests.functional" />

<securityPolicy
component="zope.securitypolicy.zopepolicy.ZopeSecurityPolicy"
Expand Down Expand Up @@ -67,9 +67,9 @@

<!-- Register a test fixture -->
<adapter
factory="grokcore.view.ftests.static.simple.DummyResource"
factory="grokcore.view.tests.functional.static.simple.DummyResource"
for="zope.publisher.interfaces.browser.IBrowserRequest"
provides="zope.interface.Interface"
name="grokcore.view.ftests.static.simple_fixture" />
name="grokcore.view.tests.functional.static.simple_fixture" />

</configure>

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 1 addition & 0 deletions src/grokcore/view/tests/base/__init__.py
@@ -0,0 +1 @@
# make this directory a package
Expand Up @@ -7,7 +7,7 @@
...
zope.configuration.config.ConfigurationExecutionError: \
martian.error.GrokError: Multiple possible ways\
to render contentprovider <class 'grokcore.view.tests.\
to render contentprovider <class 'grokcore.view.tests.base.\
contentprovider.contentprovider_render_and_template.ContentProvider'>.\
It has both a 'render' method as well as an associated template.\
in:
Expand Down
File renamed without changes.
Expand Up @@ -4,7 +4,7 @@
>>> import grokcore.view as grok
>>> grok.testing.grok(
... 'grokcore.view.tests.directoryresource.directoryispackage_fixture')
... 'grokcore.view.tests.base.directoryresource.directoryispackage_fixture')
Traceback (most recent call last):
...
martian.error.GrokError: The 'foo' resource directory must not be a python package.
Expand Down
@@ -1,18 +1,18 @@
"""
>>> import grokcore.view as grok
>>> grok.testing.grok(
... 'grokcore.view.tests.directoryresource.directoryresources_fixture')
... 'grokcore.view.tests.base.directoryresource.directoryresources_fixture')
>>> from zope.interface import Interface
>>> from zope.component import getAdapter
>>> from zope.publisher.browser import TestRequest
>>> resource_foo = getAdapter(TestRequest(), Interface, name='foo')
>>> resource_foo.context.path.replace('\\\\', '/') # Windows compliance
'...grokcore/view/tests/directoryresource/directoryresources_fixture/foo'
'...grokcore/view/tests/base/directoryresource/directoryresources_fixture/foo'
>>> resource_baz = getAdapter(TestRequest(), Interface, name='baz')
>>> resource_baz.context.path.replace('\\\\', '/') # Windows compliance
'...grokcore/view/tests/directoryresource/directoryresources_fixture/bar/baz'
'...grokcore/view/tests/base/directoryresource/directoryresources_fixture/bar/baz'
"""
File renamed without changes.
File renamed without changes.
Expand Up @@ -7,7 +7,7 @@
Import -- and thus "execute" -- the skindirective fixture to make the
directive have effect::
>>> from grokcore.view.tests.skin import directive_fixture
>>> from grokcore.view.tests.base.skin import directive_fixture
>>> import grokcore.view as grok
>>> grok.skin.bind().get(directive_fixture.IIsAnInterface)
Expand All @@ -19,7 +19,7 @@
retrieve data will fail due to the way the directive's store is
implemented::
>>> from grokcore.view.tests.skin import directive_onaclass_fixture
>>> from grokcore.view.tests.base.skin import directive_onaclass_fixture
>>> grok.skin.bind().get(directive_onaclass_fixture.NotAnInterfaceClass)
Traceback (most recent call last):
Expand All @@ -29,7 +29,7 @@
Note that the directive only supports text (ASCII string or unicode):
>>> from grokcore.view.tests.skin import directive_textonly_fixture
>>> from grokcore.view.tests.base.skin import directive_textonly_fixture
Traceback (most recent call last):
...
martian.error.GrokImportError: The 'skin' directive can only be called with\
Expand Down
@@ -1,7 +1,7 @@
"""
We cannot register two skins under the same name::
>>> from grokcore.view.tests.skin import nodouble_fixture
>>> from grokcore.view.tests.base.skin import nodouble_fixture
Traceback (most recent call last):
...
martian.error.GrokImportError: The 'skin' directive can only be called\
Expand Down
Expand Up @@ -6,8 +6,8 @@
Traceback (most recent call last):
...
martian.error.GrokError: The grok.skin() directive is used on interface\
'grokcore.view.tests.skin.notonlayer.NotALayer'. However,\
'grokcore.view.tests.skin.notonlayer.NotALayer' does not extend\
'grokcore.view.tests.base.skin.notonlayer.NotALayer'. However,\
'grokcore.view.tests.base.skin.notonlayer.NotALayer' does not extend\
IRequest which is required for interfaces that are used as\
layers and are to be registered as a skin.
"""
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -5,7 +5,7 @@
Traceback (most recent call last):
...
martian.error.GrokError: Multiple possible contexts for\
<class 'grokcore.view.tests.view.ambiguouscontext.Club'>, please use the\
<class 'grokcore.view.tests.base.view.ambiguouscontext.Club'>, please use the\
'context' directive.
"""
Expand Down
@@ -1,27 +1,27 @@
"""
>>> grok.testing.grok('grokcore.view.tests.view.cross_package_fixture')
>>> grok.testing.grok('grokcore.view.tests.base.view.cross_package_fixture')
>>> from grokcore.view import template
>>> from .cross_package_fixture import zbase
>>> from .cross_package_fixture.subpackage import sub
>>> from .cross_package_fixture.subpackage import subtemplatedir
>>> template.bind().get(zbase.BaseView)
('grokcore.view.tests.view.cross_package_fixture.zbase', 'basetemplate')
('grokcore.view.tests.base.view.cross_package_fixture.zbase', 'basetemplate')
>>> template.bind().get(sub.SubView)
('grokcore.view.tests.view.cross_package_fixture.zbase', 'basetemplate')
('grokcore.view.tests.base.view.cross_package_fixture.zbase', 'basetemplate')
>>> template.bind().get(sub.SubViewOverrideTemplate)
('grokcore.view.tests.view.cross_package_fixture.subpackage.sub',
('grokcore.view.tests.base.view.cross_package_fixture.subpackage.sub',
'subtemplate')
>>> template.bind().get(subtemplatedir.MoreSubView)
('grokcore.view.tests.view.cross_package_fixture.zbase', 'basetemplate')
('grokcore.view.tests.base.view.cross_package_fixture.zbase', 'basetemplate')
>>> template.bind().get(subtemplatedir.MoreSubViewOverrideTemplate)
('grokcore.view.tests.view.cross_package_fixture.subpackage.subtemplatedir',
('grokcore.view.tests.base.view.cross_package_fixture.subpackage.subtemplatedir',
'moretemplate')
Expand Down
@@ -0,0 +1,8 @@
import grokcore.view as grok
from grokcore.view.tests.base.view.cross_package_fixture.zbase import BaseView

class SubView(BaseView):
pass

class SubViewOverrideTemplate(BaseView):
grok.template('subtemplate')
@@ -1,5 +1,5 @@
import grokcore.view as grok
from grokcore.view.tests.view.cross_package_fixture.zbase import BaseView
from grokcore.view.tests.base.view.cross_package_fixture.zbase import BaseView

grok.templatedir('more_templates')

Expand Down
Expand Up @@ -8,7 +8,7 @@
zope.configuration.config.ConfigurationExecutionError:\
martian.error.GrokError: Conflicting\
templates found for name 'cavepainting': the inline template in\
module 'grokcore.view.tests.view.dirandinlinetemplate' conflicts\
module 'grokcore.view.tests.base.view.dirandinlinetemplate' conflicts\
with the file template in directory\
'...dirandinlinetemplate_templates' in:
Expand Down
File renamed without changes.
Expand Up @@ -7,7 +7,7 @@
...
zope.configuration.config.ConfigurationExecutionError:\
martian.error.GrokError: Multiple possible ways to render view\
<class 'grokcore.view.tests.view.dirtemplateandrender.CavePainting'>.\
<class 'grokcore.view.tests.base.view.dirtemplateandrender.CavePainting'>.\
It has both a 'render' method as well as an associated template.\
in:
Expand Down
Expand Up @@ -6,7 +6,7 @@
...
zope.configuration.config.ConfigurationExecutionError:\
martian.error.GrokError: Multiple possible ways to render view\
<class 'grokcore.view.tests.view.eithertemplateorrender.CavePainting'>.\
<class 'grokcore.view.tests.base.view.eithertemplateorrender.CavePainting'>.\
It has both a 'render' method as well as an associated template.\
in:
"""
Expand Down
Expand Up @@ -5,7 +5,7 @@
...
zope.configuration.config.ConfigurationExecutionError:\
martian.error.GrokError: Multiple possible ways to render view <class\
'grokcore.view.tests.view.eitherviewtemplateequalorrender.CavePainting'>.\
'grokcore.view.tests.base.view.eitherviewtemplateequalorrender.CavePainting'>.\
It has both a 'render' method as well as an associated template.\
in:
Expand Down
Expand Up @@ -8,7 +8,7 @@
...
zope.configuration.config.ConfigurationExecutionError:\
martian.error.GrokError: Multiple possible templates for view\
<class 'grokcore.view.tests.view.explicitimplicittemplate.Painting'>.\
<class 'grokcore.view.tests.base.view.explicitimplicittemplate.Painting'>.\
It uses grok.template('cavepainting'), but there is also a template\
called 'painting'.\
in:
Expand Down
Expand Up @@ -15,8 +15,8 @@
<h1>Mammoth Cave Painting</h1>
<ul>
<li><zope.publisher.browser.TestRequest instance URL=http://127.0.0.1></li>
<li><grokcore.view.tests.view.inline.CavePainting object at 0x...></li>
<li><grokcore.view.tests.view.inline.Mammoth object at 0x...></li>
<li><grokcore.view.tests.base.view.inline.CavePainting object at 0x...></li>
<li><grokcore.view.tests.base.view.inline.Mammoth object at 0x...></li>
<li><zope.pagetemplate.engine.TraversableModuleImporter object at 0x...></li>
</ul>
</body>
Expand Down
Expand Up @@ -11,7 +11,7 @@
From grok.testing's warn():
...
UserWarning: Found the following unassociated template after configuration\
in 'grokcore.view.tests.view.inline_unassociated': club...
in 'grokcore.view.tests.base.view.inline_unassociated': club...
>>> warnings.warn = saved_warn
Expand Down
File renamed without changes.
Expand Up @@ -5,7 +5,7 @@
Traceback (most recent call last):
...
martian.error.GrokError: No module-level context for\
<class 'grokcore.view.tests.view.missingcontext.Club'>, please use the\
<class 'grokcore.view.tests.base.view.missingcontext.Club'>, please use the\
'context' directive.
"""
Expand Down
@@ -1,7 +1,7 @@
"""
You can't call grok.name multiple times for a view
>>> import grokcore.view.tests.view.namemultiple_fixture
>>> import grokcore.view.tests.base.view.namemultiple_fixture
Traceback (most recent call last):
...
martian.error.GrokImportError: The 'name' directive can only be\
Expand Down
File renamed without changes.
@@ -1,7 +1,7 @@
"""
You can't call grok.name on a module:
>>> import grokcore.view.tests.view.nomodulename_fixture
>>> import grokcore.view.tests.base.view.nomodulename_fixture
Traceback (most recent call last):
...
martian.error.GrokImportError: The 'name' directive can only be used on\
Expand Down
Expand Up @@ -6,7 +6,7 @@
...
zope.configuration.config.ConfigurationExecutionError:\
martian.error.GrokError: View\
<class 'grokcore.view.tests.view.notemplateorrender.CavePainting'>\
<class 'grokcore.view.tests.base.view.notemplateorrender.CavePainting'>\
has no associated template or 'render' method.\
in:
Expand Down
Expand Up @@ -7,12 +7,12 @@
>>> saved_warn = warnings.warn
>>> warnings.warn = warn
>>> from grokcore.view.tests.view import shared_template_fixture
>>> from grokcore.view.tests.base.view import shared_template_fixture
>>> grok.testing.grok(shared_template_fixture.__name__)
From grok.testing's warn():
...UserWarning: Found the following unassociated template after configuration in
'grokcore.view.tests.view.shared_template_fixture.first_module': unassociated_instance...
'grokcore.view.tests.base.view.shared_template_fixture.first_module': unassociated_instance...
...UserWarning: Found the following unassociated template after configuration:
...shared_template_fixture...templates...unassociated.pt...
Expand Down
@@ -0,0 +1,3 @@
This template does not have an associated view class (in other words,
there's no grokcore.view.tests.base.view.shared_template_dir.Unassociated class), therefore it
provokes a UserWarning.
File renamed without changes.
@@ -1,7 +1,7 @@
"""
You can not use path separator in templatedir directive:
>>> import grokcore.view.tests.view.templatedirectory_with_path_sep_fixture
>>> import grokcore.view.tests.base.view.templatedirectory_with_path_sep_fixture
Traceback (most recent call last):
...
martian.error.GrokImportError: The 'templatedir' directive can not\
Expand Down
Expand Up @@ -3,7 +3,7 @@
error:
>>> grok.testing.grok(
... 'grokcore.view.tests.view.templatedirectorynotfound_fixture')
... 'grokcore.view.tests.base.view.templatedirectorynotfound_fixture')
Traceback (most recent call last):
...
martian.error.GrokImportError: The directory 'idontexit' specified by the\
Expand Down
Expand Up @@ -7,7 +7,7 @@
...
zope.configuration.config.ConfigurationExecutionError:\
martian.error.GrokError: Template cavepainting for View\
<class 'grokcore.view.tests.view.templatenotfound.Painting'>\
<class 'grokcore.view.tests.base.view.templatenotfound.Painting'>\
cannot be found.\
in:
"""
Expand Down
Expand Up @@ -33,7 +33,7 @@
Traceback (most recent call last):
...
zope.interface.interfaces.ComponentLookupError:\
((<grokcore.view.tests.view.twoviewsusetemplate.Mammoth object at 0x...>,\
((<grokcore.view.tests.base.view.twoviewsusetemplate.Mammoth object at 0x...>,\
<zope.publisher.browser.TestRequest instance URL=http://127.0.0.1>),\
<InterfaceClass zope.interface.Interface>, 'templ')
Expand Down
@@ -1,3 +1,3 @@
This template does not have an associated view class (in other words,
there's no grokcore.view.tests.view.unassociated.Index class), therefore it
there's no grokcore.view.tests.base.view.unassociated.Index class), therefore it
provokes a UserWarning.
File renamed without changes.
File renamed without changes.
Expand Up @@ -34,7 +34,7 @@
Traceback (most recent call last):
...
zope.interface.interfaces.ComponentLookupError:\
((<grokcore.view.tests.view.view.Mammoth object at 0x...>,\
((<grokcore.view.tests.base.view.view.Mammoth object at 0x...>,\
<zope.publisher.browser.TestRequest instance URL=http://127.0.0.1>),\
<InterfaceClass zope.interface.Interface>, 'food')
Expand Down
Expand Up @@ -6,7 +6,7 @@
...
martian.error.GrokError: The @grok.require decorator is used for\
method 'render' in view\
<class 'grokcore.view.tests.view.view_decorator.BogusView'>.\
<class 'grokcore.view.tests.base.view.view_decorator.BogusView'>.\
It may only be used for XML-RPC methods.
Expand Down

0 comments on commit 5bccf1c

Please sign in to comment.