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
8e901edd
Commit
8e901edd
authored
Jan 08, 2004
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
be more careful about not running tests for components that aren't
available
parent
9f68cbc7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
20 deletions
+36
-20
src/ZODB/tests/testConfig.py
src/ZODB/tests/testConfig.py
+36
-20
No files found.
src/ZODB/tests/testConfig.py
View file @
8e901edd
...
@@ -21,7 +21,7 @@ import unittest
...
@@ -21,7 +21,7 @@ import unittest
import
ZODB.config
import
ZODB.config
import
ZODB.tests
import
ZODB.tests
from
ZODB.POSException
import
ReadOnlyError
from
ZODB.POSException
import
ReadOnlyError
from
ZEO.ClientStorage
import
ClientDisconnected
class
ConfigTestBase
(
unittest
.
TestCase
):
class
ConfigTestBase
(
unittest
.
TestCase
):
def
_opendb
(
self
,
s
):
def
_opendb
(
self
,
s
):
...
@@ -84,12 +84,27 @@ class ZODBConfigTest(ConfigTestBase):
...
@@ -84,12 +84,27 @@ class ZODBConfigTest(ConfigTestBase):
"""
%
path
"""
%
path
self
.
assertRaises
(
ReadOnlyError
,
self
.
_test
,
cfg
)
self
.
assertRaises
(
ReadOnlyError
,
self
.
_test
,
cfg
)
def
test_demo_config
(
self
):
cfg
=
"""
<zodb unused-name>
<demostorage>
name foo
<mappingstorage/>
</demostorage>
</zodb>
"""
self
.
_test
(
cfg
)
class
ZEOConfigTest
(
ConfigTestBase
):
def
test_zeo_config
(
self
):
def
test_zeo_config
(
self
):
# We're looking for a port that doesn't exist so a connection attempt
# We're looking for a port that doesn't exist so a
# will fail. Instead of elaborate logic to loop over a port
# connection attempt will fail. Instead of elaborate
# calculation, we'll just pick a simple "random", likely to not-exist
# logic to loop over a port calculation, we'll just pick a
# port number and add an elaborate comment explaining this instead.
# simple "random", likely to not-exist port number and add
# Go ahead, grep for 9.
# an elaborate comment explaining this instead. Go ahead,
# grep for 9.
from
ZEO.ClientStorage
import
ClientDisconnected
cfg
=
"""
cfg
=
"""
<zodb>
<zodb>
<zeoclient>
<zeoclient>
...
@@ -100,16 +115,6 @@ class ZODBConfigTest(ConfigTestBase):
...
@@ -100,16 +115,6 @@ class ZODBConfigTest(ConfigTestBase):
"""
"""
self
.
assertRaises
(
ClientDisconnected
,
self
.
_test
,
cfg
)
self
.
assertRaises
(
ClientDisconnected
,
self
.
_test
,
cfg
)
def
test_demo_config
(
self
):
cfg
=
"""
<zodb unused-name>
<demostorage>
name foo
<mappingstorage/>
</demostorage>
</zodb>
"""
self
.
_test
(
cfg
)
class
BDBConfigTest
(
ConfigTestBase
):
class
BDBConfigTest
(
ConfigTestBase
):
def
setUp
(
self
):
def
setUp
(
self
):
...
@@ -144,10 +149,21 @@ class BDBConfigTest(ConfigTestBase):
...
@@ -144,10 +149,21 @@ class BDBConfigTest(ConfigTestBase):
def
test_suite
():
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
ZODBConfigTest
))
suite
.
addTest
(
unittest
.
makeSuite
(
ZODBConfigTest
))
# Only run the Berkeley tests if they are available
# Only run the ZEO test if ZEO is available
import
BDBStorage
try
:
if
BDBStorage
.
is_available
:
import
ZEO
suite
.
addTest
(
unittest
.
makeSuite
(
BDBConfigTest
))
except
ImportError
:
pass
else
:
suite
.
addTest
(
unittest
.
makeSuite
(
ZEOConfigTest
))
# Only run the Berkeley tests if bsddb is available
try
:
import
BDBStorage
except
ImportError
:
pass
else
:
if
BDBStorage
.
is_available
:
suite
.
addTest
(
unittest
.
makeSuite
(
BDBConfigTest
))
return
suite
return
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