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
10303c07
Commit
10303c07
authored
Feb 28, 2013
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moar resource leak patchage.
parent
166c5b76
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
22 deletions
+20
-22
src/ZODB/tests/testFileStorage.py
src/ZODB/tests/testFileStorage.py
+13
-14
src/ZODB/tests/testZODB.py
src/ZODB/tests/testZODB.py
+7
-8
No files found.
src/ZODB/tests/testFileStorage.py
View file @
10303c07
...
@@ -234,20 +234,19 @@ class FileStorageTests(
...
@@ -234,20 +234,19 @@ class FileStorageTests(
self
.
open
()
self
.
open
()
# Open .fs directly, and damage content.
# Open .fs directly, and damage content.
f
=
open
(
'FileStorageTests.fs'
,
'r+b'
)
with
open
(
'FileStorageTests.fs'
,
'r+b'
)
as
f
:
f
.
seek
(
0
,
2
)
f
.
seek
(
0
,
2
)
pos2
=
f
.
tell
()
-
8
pos2
=
f
.
tell
()
-
8
f
.
seek
(
pos2
)
f
.
seek
(
pos2
)
tlen2
=
U64
(
f
.
read
(
8
))
# length-8 of the last transaction
tlen2
=
U64
(
f
.
read
(
8
))
# length-8 of the last transaction
pos1
=
pos2
-
tlen2
+
8
# skip over the tid at the start
pos1
=
pos2
-
tlen2
+
8
# skip over the tid at the start
f
.
seek
(
pos1
)
f
.
seek
(
pos1
)
tlen1
=
U64
(
f
.
read
(
8
))
# should be redundant length-8
tlen1
=
U64
(
f
.
read
(
8
))
# should be redundant length-8
self
.
assertEqual
(
tlen1
,
tlen2
)
# verify that it is redundant
self
.
assertEqual
(
tlen1
,
tlen2
)
# verify that it is redundant
# Now damage the second copy.
# Now damage the second copy.
f
.
seek
(
pos2
)
f
.
seek
(
pos2
)
f
.
write
(
p64
(
tlen2
-
1
))
f
.
write
(
p64
(
tlen2
-
1
))
f
.
close
()
# Try to pack. This used to yield
# Try to pack. This used to yield
# NameError: global name 's' is not defined
# NameError: global name 's' is not defined
...
...
src/ZODB/tests/testZODB.py
View file @
10303c07
...
@@ -71,14 +71,13 @@ class ZODBTests(ZODB.tests.util.TestCase):
...
@@ -71,14 +71,13 @@ class ZODBTests(ZODB.tests.util.TestCase):
assert
len
(
ob
)
>
10
,
'Insufficient test data'
assert
len
(
ob
)
>
10
,
'Insufficient test data'
try
:
try
:
import
tempfile
import
tempfile
f
=
tempfile
.
TemporaryFile
()
with
tempfile
.
TemporaryFile
(
prefix
=
"DUP"
)
as
f
:
ob
.
_p_jar
.
exportFile
(
ob
.
_p_oid
,
f
)
ob
.
_p_jar
.
exportFile
(
ob
.
_p_oid
,
f
)
assert
f
.
tell
()
>
0
,
'Did not export correctly'
assert
f
.
tell
()
>
0
,
'Did not export correctly'
f
.
seek
(
0
)
f
.
seek
(
0
)
new_ob
=
ob
.
_p_jar
.
importFile
(
f
)
new_ob
=
ob
.
_p_jar
.
importFile
(
f
)
self
.
assertEqual
(
new_ob
,
ob
)
self
.
assertEqual
(
new_ob
,
ob
)
root
[
'dup'
]
=
new_ob
root
[
'dup'
]
=
new_ob
f
.
close
()
if
abort_it
:
if
abort_it
:
transaction
.
abort
()
transaction
.
abort
()
else
:
else
:
...
...
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