Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Trevor Cappallo
OperationalLogging
Commits
d3668365
Commit
d3668365
authored
Sep 01, 2015
by
Trevor Cappallo
Browse files
add call wrapper unit test
parent
e11cbc45
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletion
+29
-1
lib/OperationalLogger.py
lib/OperationalLogger.py
+2
-1
lib/TestCallWrappers.py
lib/TestCallWrappers.py
+27
-0
No files found.
lib/OperationalLogger.py
View file @
d3668365
...
...
@@ -56,7 +56,8 @@ def __exit_handler(logger, notify):
class
OperationalLogger
:
"""Main class for Operational Logging."""
"""Main class for Operational Logging."""
DEFAULT_LOG_FORMAT_FILE
=
'[%(asctime)s][%(levelname)5s][p%(process)d][%(filename)s:%(lineno)d] %(message)s'
DEFAULT_LOG_FORMAT_CONSOLE
=
'%(asctime)s (%(levelname)5s) [%(filename)s:%(lineno)d] %(message)s'
...
...
lib/TestCallWrappers.py
0 → 100644
View file @
d3668365
#!/usr/bin/env python
"""Unit tests for OperationalLogging."""
import
unittest
from
nose.tools
import
raises
,
eq_
import
logging
import
OperationalLogger
as
OpLog
import
subprocess
class
TestCallWrappers
(
unittest
.
TestCase
):
def
setUp
(
self
):
OpLog
.
setup
(
notify
=
{
'ERROR'
:
'tcappallo@veriskclimate.com'
})
def
tearDown
(
self
):
pass
def
test_call_wrappers
(
self
):
test_cmd
=
[
"ls"
,
"/home"
,
"-lart"
]
eq_
(
subprocess
.
call
(
test_cmd
),
OpLog
.
call
(
test_cmd
))
eq_
(
subprocess
.
check_call
(
test_cmd
),
OpLog
.
check_call
(
test_cmd
))
eq_
(
subprocess
.
check_output
(
test_cmd
),
OpLog
.
check_output
(
test_cmd
))
if
__name__
==
'__main__'
:
unittest
.
main
()
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