Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
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
ZEO
Commits
ac9692f7
Commit
ac9692f7
authored
Mar 31, 2016
by
Stefan H. Holek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for AttributeError: 'ZEOServer' object has no attribute 'server'.
parent
50692664
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
76 additions
and
0 deletions
+76
-0
src/ZEO/tests/testZEOServer.py
src/ZEO/tests/testZEOServer.py
+76
-0
No files found.
src/ZEO/tests/testZEOServer.py
0 → 100644
View file @
ac9692f7
#
# Fix AttributeError: 'ZEOServer' object has no attribute 'server' in
# ZEOServer.main
#
import
unittest
from
ZEO.runzeo
import
ZEOServer
class
TestStorageServer
:
def
__init__
(
self
,
fail_create_server
):
self
.
called
=
[]
if
fail_create_server
:
raise
RuntimeError
()
def
close
(
self
):
self
.
called
.
append
(
"close"
)
class
TestZEOServer
(
ZEOServer
):
def
__init__
(
self
,
fail_create_server
=
False
,
fail_loop_forever
=
False
):
ZEOServer
.
__init__
(
self
,
None
)
self
.
called
=
[]
self
.
fail_create_server
=
fail_create_server
self
.
fail_loop_forever
=
fail_loop_forever
def
setup_default_logging
(
self
):
self
.
called
.
append
(
"setup_default_logging"
)
def
check_socket
(
self
):
self
.
called
.
append
(
"check_socket"
)
def
clear_socket
(
self
):
self
.
called
.
append
(
"clear_socket"
)
def
make_pidfile
(
self
):
self
.
called
.
append
(
"make_pidfile"
)
def
open_storages
(
self
):
self
.
called
.
append
(
"open_storages"
)
def
setup_signals
(
self
):
self
.
called
.
append
(
"setup_signals"
)
def
create_server
(
self
):
self
.
called
.
append
(
"create_server"
)
self
.
server
=
TestStorageServer
(
self
.
fail_create_server
)
def
loop_forever
(
self
):
self
.
called
.
append
(
"loop_forever"
)
if
self
.
fail_loop_forever
:
raise
RuntimeError
()
def
close_server
(
self
):
self
.
called
.
append
(
"close_server"
)
ZEOServer
.
close_server
(
self
)
def
clear_socket
(
self
):
self
.
called
.
append
(
"clear_socket"
)
def
remove_pidfile
(
self
):
self
.
called
.
append
(
"remove_pidfile"
)
class
AttributeErrorTests
(
unittest
.
TestCase
):
def
testFailCreateServer
(
self
):
# Demonstrate the AttributeError
zeo
=
TestZEOServer
(
fail_create_server
=
True
)
self
.
assertRaises
(
RuntimeError
,
zeo
.
main
)
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
AttributeErrorTests
))
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