Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Zope
Commits
359b97aa
Commit
359b97aa
authored
Aug 02, 2003
by
Chris McDonough
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix failing tests and make more assertions about logger levels.
parent
314a97b9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
6 deletions
+17
-6
lib/python/Zope/Startup/tests/testStarter.py
lib/python/Zope/Startup/tests/testStarter.py
+17
-6
No files found.
lib/python/Zope/Startup/tests/testStarter.py
View file @
359b97aa
...
@@ -105,20 +105,27 @@ class ZopeStarterTestCase(unittest.TestCase):
...
@@ -105,20 +105,27 @@ class ZopeStarterTestCase(unittest.TestCase):
path <<INSTANCE_HOME>>/event.log
path <<INSTANCE_HOME>>/event.log
level info
level info
</logfile>
</logfile>
<logfile>
path <<INSTANCE_HOME>>/event2.log
level blather
</logfile>
</eventlog>"""
)
</eventlog>"""
)
starter
=
ZopeStarter
(
conf
)
starter
=
ZopeStarter
(
conf
)
self
.
assertEqual
(
zLOG
.
EventLogger
.
EventLogger
.
logger
.
level
,
logging
.
NOTSET
)
starter
.
setupStartupHandler
()
starter
.
setupStartupHandler
()
self
.
assert_
(
not
zLOG
.
_call_initialize
)
self
.
assert_
(
not
zLOG
.
_call_initialize
)
self
.
assertEqual
(
starter
.
startup_handler
.
formatter
,
self
.
assertEqual
(
starter
.
startup_handler
.
formatter
,
zLOG
.
EventLogger
.
formatters
[
'file'
])
zLOG
.
EventLogger
.
formatters
[
'file'
])
self
.
assertEqual
(
starter
.
startup_handler
.
level
,
logging
.
DEBUG
)
# startup handler should take on the level of the event log handler
# with the lowest level
self
.
assertEqual
(
starter
.
startup_handler
.
level
,
15
)
# 15 is BLATHER
self
.
assertEqual
(
starter
.
startup_handler
,
self
.
assertEqual
(
starter
.
startup_handler
,
zLOG
.
EventLogger
.
EventLogger
.
logger
.
handlers
[
0
])
zLOG
.
EventLogger
.
EventLogger
.
logger
.
handlers
[
0
])
self
.
assertEqual
(
len
(
zLOG
.
EventLogger
.
EventLogger
.
logger
.
handlers
),
1
)
self
.
assertEqual
(
zLOG
.
EventLogger
.
EventLogger
.
logger
.
level
,
self
.
assertEqual
(
zLOG
.
EventLogger
.
EventLogger
.
logger
.
level
,
logging
.
DEBUG
)
15
)
self
.
assertEqual
(
starter
.
startup_handler
.
level
,
logging
.
DEBUG
)
self
.
assertEqual
(
len
(
zLOG
.
EventLogger
.
EventLogger
.
logger
.
handlers
),
1
)
self
.
failUnlessEqual
(
starter
.
startup_handler
.
stream
,
sys
.
stderr
)
self
.
failUnlessEqual
(
starter
.
startup_handler
.
stream
,
sys
.
stderr
)
conf
=
self
.
load_config_text
(
"""
conf
=
self
.
load_config_text
(
"""
instancehome <<INSTANCE_HOME>>
instancehome <<INSTANCE_HOME>>
...
@@ -230,7 +237,7 @@ class ZopeStarterTestCase(unittest.TestCase):
...
@@ -230,7 +237,7 @@ class ZopeStarterTestCase(unittest.TestCase):
import
sys
import
sys
conf
=
self
.
load_config_text
(
"""
conf
=
self
.
load_config_text
(
"""
instancehome <<INSTANCE_HOME>>
instancehome <<INSTANCE_HOME>>
debug-mode off
debug-mode off
<eventlog>
<eventlog>
level info
level info
<logfile>
<logfile>
...
@@ -252,11 +259,15 @@ class ZopeStarterTestCase(unittest.TestCase):
...
@@ -252,11 +259,15 @@ class ZopeStarterTestCase(unittest.TestCase):
</logger>
</logger>
"""
)
"""
)
try
:
try
:
self
.
assertEqual
(
zLOG
.
EventLogger
.
EventLogger
.
logger
.
level
,
logging
.
NOTSET
)
starter
=
ZopeStarter
(
conf
)
starter
=
ZopeStarter
(
conf
)
starter
.
setupStartupHandler
()
starter
.
setupStartupHandler
()
starter
.
info
(
'hello'
)
starter
.
info
(
'hello'
)
starter
.
removeStartupHandler
()
starter
.
removeStartupHandler
()
starter
.
setupConfiguredLoggers
()
starter
.
setupConfiguredLoggers
()
self
.
assertEqual
(
zLOG
.
EventLogger
.
EventLogger
.
logger
.
level
,
logging
.
INFO
)
starter
.
flushStartupHandlerBuffer
()
starter
.
flushStartupHandlerBuffer
()
l
=
open
(
os
.
path
.
join
(
TEMPNAME
,
'event.log'
)).
read
()
l
=
open
(
os
.
path
.
join
(
TEMPNAME
,
'event.log'
)).
read
()
self
.
failUnless
(
l
.
find
(
'hello'
)
>
-
1
)
self
.
failUnless
(
l
.
find
(
'hello'
)
>
-
1
)
...
...
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