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
ac8ffd9e
Commit
ac8ffd9e
authored
Apr 23, 2005
by
Stefan H. Holek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Explicitly close connections to "sandbox" databases.
parent
dc9b9512
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
0 deletions
+21
-0
lib/python/Testing/ZopeTestCase/doc/CHANGES.txt
lib/python/Testing/ZopeTestCase/doc/CHANGES.txt
+2
-0
lib/python/Testing/ZopeTestCase/sandbox.py
lib/python/Testing/ZopeTestCase/sandbox.py
+3
-0
lib/python/Testing/ZopeTestCase/testShoppingCart.py
lib/python/Testing/ZopeTestCase/testShoppingCart.py
+16
-0
No files found.
lib/python/Testing/ZopeTestCase/doc/CHANGES.txt
View file @
ac8ffd9e
...
@@ -10,6 +10,8 @@
...
@@ -10,6 +10,8 @@
- ZopeLite now takes care not to monkey patch an already started Zope.
- ZopeLite now takes care not to monkey patch an already started Zope.
- PortalTestCase no longer calls _refreshSkinData() as CMF is smart enough
- PortalTestCase no longer calls _refreshSkinData() as CMF is smart enough
now (and CMF 1.5+ does not work that way anyway).
now (and CMF 1.5+ does not work that way anyway).
- Fixed a bug where using sessions in sandboxed (functional) tests would cause
connection pool depletion and subsequent hangs. Thanks to Balazs Ree.
0.9.6
0.9.6
- Dropped support for Zope 2.5 as it lacks the setSecurityManager() API.
- Dropped support for Zope 2.5 as it lacks the setSecurityManager() API.
...
...
lib/python/Testing/ZopeTestCase/sandbox.py
View file @
ac8ffd9e
...
@@ -17,6 +17,7 @@ $Id: sandbox.py,v 1.2 2004/08/19 15:31:26 shh42 Exp $
...
@@ -17,6 +17,7 @@ $Id: sandbox.py,v 1.2 2004/08/19 15:31:26 shh42 Exp $
import
ZopeLite
as
Zope2
import
ZopeLite
as
Zope2
import
transaction
import
transaction
import
base
import
utils
import
utils
...
@@ -31,6 +32,7 @@ class Sandboxed:
...
@@ -31,6 +32,7 @@ class Sandboxed:
def
_app
(
self
):
def
_app
(
self
):
'''Returns the app object for a test.'''
'''Returns the app object for a test.'''
app
=
Zope2
.
app
(
Zope2
.
sandbox
().
open
())
app
=
Zope2
.
app
(
Zope2
.
sandbox
().
open
())
base
.
_connections
.
register
(
app
.
_p_jar
)
AppZapper
().
set
(
app
)
AppZapper
().
set
(
app
)
return
utils
.
makerequest
(
app
)
return
utils
.
makerequest
(
app
)
...
@@ -38,6 +40,7 @@ class Sandboxed:
...
@@ -38,6 +40,7 @@ class Sandboxed:
'''Clears the transaction and the AppZapper.'''
'''Clears the transaction and the AppZapper.'''
transaction
.
abort
()
transaction
.
abort
()
AppZapper
().
clear
()
AppZapper
().
clear
()
base
.
closeConnections
()
class
AppZapper
:
class
AppZapper
:
...
...
lib/python/Testing/ZopeTestCase/testShoppingCart.py
View file @
ac8ffd9e
...
@@ -105,11 +105,27 @@ class TestShoppingCart(ZopeTestCase.ZopeTestCase):
...
@@ -105,11 +105,27 @@ class TestShoppingCart(ZopeTestCase.ZopeTestCase):
self
.
cart
.
addItems
([
DummyOrder
(
'510-007'
,
2
),])
self
.
cart
.
addItems
([
DummyOrder
(
'510-007'
,
2
),])
self
.
assertEqual
(
self
.
cart
.
getTotal
(),
149.95
)
self
.
assertEqual
(
self
.
cart
.
getTotal
(),
149.95
)
def
testGetItem
(
self
):
# Getting an item from the "database" should work
item
=
self
.
cart
.
getItem
(
'510-115'
)
self
.
assertEqual
(
item
[
'id'
],
'510-115'
)
self
.
assertEqual
(
item
[
'title'
],
'Econo Feeder'
)
self
.
assertEqual
(
item
[
'price'
],
7.95
)
def
testEight
(
self
):
# Additional test to trigger connection pool depletion bug
pass
class
TestSandboxedShoppingCart
(
ZopeTestCase
.
Sandboxed
,
TestShoppingCart
):
'''Demonstrate that sessions work in sandboxes'''
def
test_suite
():
def
test_suite
():
from
unittest
import
TestSuite
,
makeSuite
from
unittest
import
TestSuite
,
makeSuite
suite
=
TestSuite
()
suite
=
TestSuite
()
suite
.
addTest
(
makeSuite
(
TestShoppingCart
))
suite
.
addTest
(
makeSuite
(
TestShoppingCart
))
suite
.
addTest
(
makeSuite
(
TestSandboxedShoppingCart
))
return
suite
return
suite
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
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