Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
34d0725e
Commit
34d0725e
authored
Mar 17, 2021
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qa: at the end of each ZODB test, check there is no storage space leak
parent
28e097c8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
19 deletions
+44
-19
neo/tests/zodb/__init__.py
neo/tests/zodb/__init__.py
+42
-12
neo/tests/zodb/testZODB.py
neo/tests/zodb/testZODB.py
+2
-7
No files found.
neo/tests/zodb/__init__.py
View file @
34d0725e
...
...
@@ -41,23 +41,53 @@ class ZODBTestCase(TestCase):
if
functional
:
kw
[
'temp_dir'
]
=
self
.
getTempDirectory
()
self
.
neo
=
NEOCluster
(
**
kw
)
self
.
neo
.
start
()
self
.
open
()
def
_tearDown
(
self
,
success
):
def
__init__
(
self
,
methodName
):
super
(
ZODBTestCase
,
self
).
__init__
(
methodName
)
test
=
getattr
(
self
,
methodName
).
__func__
def
runTest
():
try
:
self
.
neo
.
start
()
self
.
open
()
test
(
self
)
if
not
functional
:
orphan
=
self
.
neo
.
storage
.
dm
.
getOrphanList
()
finally
:
self
.
close
()
if
functional
:
self
.
neo
.
stop
()
else
:
self
.
neo
.
stop
(
None
)
except
Exception
:
if
success
:
raise
del
self
.
neo
,
self
.
_storage
if
functional
:
dm
=
self
.
neo
.
getSQLConnection
(
*
self
.
neo
.
db_list
)
try
:
dm
.
setup
()
orphan
=
set
(
dm
.
getOrphanList
())
orphan
.
difference_update
(
dm
.
_uncommitted_data
)
finally
:
dm
.
close
()
self
.
assertFalse
(
orphan
)
setattr
(
self
,
methodName
,
runTest
)
def
_tearDown
(
self
,
success
):
del
self
.
neo
super
(
ZODBTestCase
,
self
).
_tearDown
(
success
)
assertEquals
=
failUnlessEqual
=
TestCase
.
assertEqual
assertNotEquals
=
failIfEqual
=
TestCase
.
assertNotEqual
def
open
(
self
,
**
kw
):
self
.
_storage
=
self
.
neo
.
getZODBStorage
(
**
kw
)
self
.
_open
(
_storage
=
self
.
neo
.
getZODBStorage
(
**
kw
))
def
_open
(
self
,
**
kw
):
self
.
close
()
(
attr
,
value
),
=
kw
.
iteritems
()
setattr
(
self
,
attr
,
value
)
def
close
():
getattr
(
self
,
attr
).
close
()
delattr
(
self
,
attr
)
del
self
.
close
self
.
close
=
close
def
close
(
self
):
pass
neo/tests/zodb/testZODB.py
View file @
34d0725e
...
...
@@ -22,13 +22,8 @@ from . import ZODBTestCase
class
NEOZODBTests
(
ZODBTestCase
,
testZODB
.
ZODBTests
):
def
setUp
(
self
):
super
(
NEOZODBTests
,
self
).
setUp
()
self
.
_db
=
ZODB
.
DB
(
self
.
_storage
)
def
_tearDown
(
self
,
success
):
self
.
_db
.
close
()
super
(
NEOZODBTests
,
self
).
_tearDown
(
success
)
def
open
(
self
):
self
.
_open
(
_db
=
ZODB
.
DB
(
self
.
neo
.
getZODBStorage
()))
if
__name__
==
"__main__"
:
suite
=
unittest
.
makeSuite
(
NEOZODBTests
,
'check'
)
...
...
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