Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
PandABox-tst
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
PandABox-tst
Commits
a2eb1ccd
Commit
a2eb1ccd
authored
Feb 27, 2017
by
Christopher Turner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add option to view log file at end of test
parent
1c3f94e9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
4 deletions
+17
-4
run_tests.py
run_tests.py
+17
-4
No files found.
run_tests.py
View file @
a2eb1ccd
...
...
@@ -73,12 +73,12 @@ class RunTests(object):
summary
=
cls
.
get_summary
()
self
.
console_logger
.
info
(
summary
)
def
setup_logging
(
logPath
,
fileName
):
def
setup_logging
(
logPath
):
file_format_string
=
"
%(asctime)
s [
%(levelname)-5
s] [
%(name)-10
s]
%(message)
s"
console_format_string
=
"
%(asctime)
s [
%(levelname)-5
s]
%(message)
s"
logging
.
basicConfig
(
level
=
logging
.
DEBUG
,
format
=
file_format_string
,
filename
=
os
.
path
.
join
(
logPath
,
fileName
)
)
filename
=
logPath
)
logFormatter
=
logging
.
Formatter
(
console_format_string
)
#set to log to console
...
...
@@ -89,12 +89,25 @@ def setup_logging(logPath, fileName):
file_logger
=
logging
.
getLogger
(
'filelog'
)
def
view_log
(
log_file_path
):
inputy
=
'.'
while
inputy
.
strip
(
'
\n
'
)
not
in
[
'y'
,
'n'
]:
print
"
\n
View logfile: {} [y/n]"
.
format
(
log_file_path
)
inputy
=
raw_input
()
if
inputy
.
strip
(
'
\n
'
)
in
[
'y'
]:
f
=
open
(
log_file_path
,
'r'
)
file_contents
=
f
.
read
()
print
(
file_contents
)
f
.
close
()
def
main
():
timestr
=
time
.
strftime
(
"
%
Y
%
m
%
d-
%
H
%
M
%
S"
)
log_file_name
=
"{}.log"
.
format
(
timestr
)
setup_logging
(
'log'
,
log_file_name
)
log_file_name
=
os
.
path
.
join
(
'log'
,
"{}.log"
.
format
(
timestr
)
)
setup_logging
(
log_file_name
)
rt
=
RunTests
(
'config'
,
'172.23.252.202'
,
8888
)
#pass in as parameter
rt
.
run_tests
()
view_log
(
log_file_name
)
if
__name__
==
'__main__'
:
main
()
\ No newline at end of file
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