Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZODB
Commits
70551073
Commit
70551073
authored
Mar 04, 2004
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added missing test cleanup code
parent
7f49a29f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
3 deletions
+27
-3
src/ZODB/broken.py
src/ZODB/broken.py
+19
-2
src/ZODB/tests/testBroken.py
src/ZODB/tests/testBroken.py
+8
-1
No files found.
src/ZODB/broken.py
View file @
70551073
...
...
@@ -13,7 +13,7 @@
##############################################################################
"""Broken object support
$Id: broken.py,v 1.
2 2004/02/27 21:40:20 jeremy
Exp $
$Id: broken.py,v 1.
3 2004/03/04 22:41:52 jim
Exp $
"""
import
sys
...
...
@@ -87,6 +87,9 @@ class Broken(object):
>>> a2.__Broken_state__
{'x': 1}
Cleanup::
>>> broken_cache.clear()
"""
__Broken_state__
=
__Broken_initargs__
=
None
...
...
@@ -120,7 +123,10 @@ class Broken(object):
def
__setattr__
(
self
,
name
,
value
):
raise
BrokenModified
(
"Can't change broken objects"
)
def
find_global
(
modulename
,
globalname
,
Broken
=
Broken
):
def
find_global
(
modulename
,
globalname
,
# These are *not* optimizations. Callers can override these.
Broken
=
Broken
,
type
=
type
,
):
"""Find a global object, returning a broken class if it can't be found.
This function looks up global variable in modules::
...
...
@@ -167,6 +173,9 @@ def find_global(modulename, globalname, Broken=Broken):
>>> find_global('ZODB.not.there', 'atall') is broken
True
Cleanup::
>>> broken_cache.clear()
"""
try
:
__import__
(
modulename
)
...
...
@@ -217,6 +226,10 @@ def rebuild(modulename, globalname, *args):
>>> del sys.modules['ZODB.notthere']
Cleanup::
>>> broken_cache.clear()
"""
class_
=
find_global
(
modulename
,
globalname
)
return
class_
.
__new__
(
class_
,
*
args
)
...
...
@@ -280,6 +293,10 @@ class PersistentBroken(Broken, persistent.Persistent):
>>> a.__getstate__()
{'y': 2}
Cleanup::
>>> broken_cache.clear()
"""
def
__new__
(
class_
,
*
args
):
...
...
src/ZODB/tests/testBroken.py
View file @
70551073
...
...
@@ -13,7 +13,7 @@
##############################################################################
"""Test broken-object suppport
$Id: testBroken.py,v 1.
2 2004/02/25 13:06:12
jim Exp $
$Id: testBroken.py,v 1.
3 2004/03/04 22:41:53
jim Exp $
"""
import
sys
...
...
@@ -71,8 +71,15 @@ def test_integration():
>>> a3.__Broken_state__
{'x': 1}
Let's clean up:
>>> db.close()
>>> del sys.modules['ZODB.not']
Cleanup:
>>> import ZODB.broken
>>> ZODB.broken.broken_cache.clear()
"""
def
test_suite
():
...
...
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