Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
b96b2151
Commit
b96b2151
authored
Mar 30, 2010
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid some more dependencies on Products.Five from outside of it
parent
e33526ea
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
55 additions
and
12 deletions
+55
-12
src/OFS/tests/testObjectManager.py
src/OFS/tests/testObjectManager.py
+2
-2
src/OFS/tests/test_registerclass.py
src/OFS/tests/test_registerclass.py
+2
-2
src/OFS/tests/test_registerpackage.py
src/OFS/tests/test_registerpackage.py
+2
-2
src/Testing/ZopeTestCase/directives.zcml
src/Testing/ZopeTestCase/directives.zcml
+10
-0
src/Testing/ZopeTestCase/testPlaceless.py
src/Testing/ZopeTestCase/testPlaceless.py
+39
-6
No files found.
src/OFS/tests/testObjectManager.py
View file @
b96b2151
...
...
@@ -14,7 +14,6 @@ from logging import getLogger
from
OFS.metaconfigure
import
setDeprecatedManageAddDelete
from
OFS.ObjectManager
import
ObjectManager
from
OFS.SimpleItem
import
SimpleItem
import
Products.Five
from
Zope2.App
import
zcml
from
zExceptions
import
BadRequest
...
...
@@ -73,7 +72,8 @@ class ObjectManagerTests(PlacelessSetup, unittest.TestCase):
def
setUp
(
self
):
super
(
ObjectManagerTests
,
self
).
setUp
()
self
.
saved_cfg_debug_mode
=
getConfiguration
().
debug_mode
zcml
.
load_config
(
'meta.zcml'
,
Products
.
Five
)
import
Zope2.App
zcml
.
load_config
(
'meta.zcml'
,
Zope2
.
App
)
import
OFS
zcml
.
load_config
(
'configure.zcml'
,
OFS
)
setDeprecatedManageAddDelete
(
ItemForDeletion
)
...
...
src/OFS/tests/test_registerclass.py
View file @
b96b2151
...
...
@@ -23,7 +23,7 @@ def test_registerClass():
>>> from zope.component.testing import setUp, tearDown
>>> setUp()
>>> import Products
>>> import
Products.Five
>>> import
Zope2.App
>>> from Zope2.App import zcml
>>> from Products.Five.tests.testing.simplecontent import SimpleContent
>>> from Products.Five.tests.testing.simplecontent import ISimpleContent
...
...
@@ -46,7 +46,7 @@ def test_registerClass():
... global="false"
... />
... </configure>'''
>>> zcml.load_config('meta.zcml',
Products.Five
)
>>> zcml.load_config('meta.zcml',
Zope2.App
)
>>> zcml.load_string(configure_zcml)
Make sure that the class attributes are set correctly::
...
...
src/OFS/tests/test_registerpackage.py
View file @
b96b2151
...
...
@@ -29,9 +29,9 @@ def test_registerPackage():
>>> from zope.component.testing import setUp, tearDown
>>> setUp()
>>> import Products
>>> import
Products.Five
>>> import
Zope2.App
>>> from Zope2.App import zcml
>>> zcml.load_config('meta.zcml',
Products.Five
)
>>> zcml.load_config('meta.zcml',
Zope2.App
)
Make sure a python package with a valid initialize gets its
initialize function called::
...
...
src/Testing/ZopeTestCase/directives.zcml
0 → 100644
View file @
b96b2151
<configure xmlns="http://namespaces.zope.org/zope"
xmlns:five="http://namespaces.zope.org/five">
<adapter
for=".testPlaceless.IAdaptable"
provides=".testPlaceless.IAdapted"
factory=".testPlaceless.Adapter"
/>
</configure>
src/Testing/ZopeTestCase/testPlaceless.py
View file @
b96b2151
...
...
@@ -15,22 +15,55 @@
$Id$
"""
from
zope.component
import
adapts
from
zope.interface
import
implements
,
Interface
from
Testing
import
ZopeTestCase
from
Testing.ZopeTestCase.placeless
import
setUp
,
tearDown
from
Testing.ZopeTestCase.placeless
import
zcml
from
Testing.ZopeTestCase.placeless
import
temporaryPlacelessSetUp
import
Products.Five.tests
from
Products.Five.tests.adapters
import
IAdapted
from
Products.Five.tests.adapters
import
Adaptable
def
setupZCML
():
import
AccessControl
zcml
.
load_config
(
'meta.zcml'
,
Products
.
Five
)
import
Zope2.App
zcml
.
load_config
(
'meta.zcml'
,
Zope2
.
App
)
zcml
.
load_config
(
'permissions.zcml'
,
AccessControl
)
zcml
.
load_config
(
'directives.zcml'
,
Products
.
Five
.
tests
)
zcml
.
load_config
(
'directives.zcml'
,
ZopeTestCase
)
class
IAdaptable
(
Interface
):
"""This is a Zope interface.
"""
def
method
():
"""This method will be adapted
"""
class
IAdapted
(
Interface
):
"""The interface we adapt to.
"""
def
adaptedMethod
():
"""A method to adapt.
"""
class
Adaptable
:
implements
(
IAdaptable
)
def
method
(
self
):
return
"The method"
class
Adapter
:
implements
(
IAdapted
)
adapts
(
IAdaptable
)
def
__init__
(
self
,
context
):
self
.
context
=
context
def
adaptedMethod
(
self
):
return
"Adapted: %s"
%
self
.
context
.
method
()
class
TestPlacelessSetUp
(
ZopeTestCase
.
ZopeTestCase
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment