Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
Production Test Suite
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
9
Issues
9
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
Production Test Suite
Commits
30c966a0
Commit
30c966a0
authored
May 13, 2011
by
Juan David González Cobas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tps: dump default config values
parent
57c42d34
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
95 additions
and
0 deletions
+95
-0
tps.py
tps.py
+70
-0
tpsexcept.py
tpsexcept.py
+25
-0
No files found.
tps.py
0 → 100644
View file @
30c966a0
#! /usr/bin/env python
# coding: utf8
import
sys
import
cmd
import
os
,
os
.
path
import
datetime
from
ConfigParser
import
ConfigParser
from
optparse
import
OptionParser
from
hashlib
import
sha1
as
sha160
from
tpsexcept
import
*
default_config_file
=
'default.cfg'
class
Suite
(
object
):
def
__init__
(
self
,
cfgfilename
=
default_config_file
):
self
.
config
=
cfgfilename
self
.
path
=
'./tests'
self
.
logpath
=
'./logs'
self
.
pattern
=
'test[0-9][0-9]'
self
.
log_pattern
=
'output_
%(serial)
s_
%(timestamp)
s_
%(test)
s.txt'
def
run
(
self
):
pass
def
write_cfg
(
self
):
config
=
ConfigParser
()
config
.
add_section
(
'global'
)
config
.
set
(
'global'
,
'timestamp'
,
timestamp
())
config
.
set
(
'global'
,
'sha'
,
sha
(
'3.14'
))
config
.
add_section
(
'files'
)
config
.
set
(
'files'
,
'path'
,
self
.
path
)
config
.
set
(
'files'
,
'logs'
,
self
.
logpath
)
config
.
set
(
'files'
,
'pattern'
,
self
.
pattern
)
config
.
set
(
'files'
,
'log_pattern'
,
self
.
log_pattern
)
# Writing our configuration file
with
open
(
self
.
config
,
'wb'
)
as
configfile
:
config
.
write
(
configfile
)
def
timestamp
():
"""timestamp for now
"""
return
datetime
.
datetime
.
now
()
.
strftime
(
'
%
Y
%
m
%
d.
%
H
%
M
%
S'
)
def
sha
(
blob
,
len
=
7
):
"""create a sha-160 hash of a binary object
len is the number of hex digits to take from the hex digest,
defaulting to 7 just as in git
"""
hash
=
sha160
(
blob
)
ret
=
hash
.
hexdigest
()
if
len
:
return
ret
[:
len
]
if
__name__
==
'__main__'
:
parser
=
OptionParser
()
parser
.
add_option
(
"-c"
,
"--config"
,
dest
=
"config"
,
default
=
default_config_file
,
help
=
"config file name"
,
metavar
=
"FILE"
)
(
options
,
args
)
=
parser
.
parse_args
()
s
=
Suite
(
options
.
config
)
s
.
write_cfg
()
tpsexcept.py
0 → 100644
View file @
30c966a0
#! /usr/bin/env python
# coding: utf8
class
TpsException
(
Exception
):
pass
class
TpsCritical
(
TpsException
):
"""critical error, abort the whole test suite"""
pass
class
TpsError
(
TpsException
):
"""error, continue remaining tests in test suite"""
pass
class
TpsUser
(
TpsException
):
"""error, user intervention required"""
pass
class
TpsWarning
(
TpsException
):
"""warning, a cautionary message should be displayed"""
pass
if
__name__
==
'__main__'
:
pass
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