Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
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
gevent
Commits
f2a77e1b
Commit
f2a77e1b
authored
Nov 15, 2009
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
record_results.py: run the test without recording if sqlite3 is not available
parent
7fe3dc91
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
14 deletions
+25
-14
greentest/record_results.py
greentest/record_results.py
+25
-14
No files found.
greentest/record_results.py
View file @
f2a77e1b
...
...
@@ -31,7 +31,11 @@ from os.path import abspath, dirname, join, split
try
:
import
sqlite3
except
ImportError
:
import
pysqlite2.dbapi2
as
sqlite3
try
:
import
pysqlite2.dbapi2
as
sqlite3
except
ImportError
:
sqlite3
=
None
print
"sqlite3 not installed, won't record the results in the database"
import
warnings
from
greentest
import
disabled_marker
...
...
@@ -46,17 +50,26 @@ def get_results_db():
pass
return
join
(
path
,
'results.db'
)
def
record
(
argv
,
output
,
returncode
):
path
=
get_results_db
()
c
=
sqlite3
.
connect
(
path
)
c
.
execute
(
'''create table if not exists testresult
(id integer primary key autoincrement,
command text,
output text,
exitcode integer)'''
)
c
.
execute
(
'insert into testresult (command, output, exitcode)'
'values (?, ?, ?)'
,
(
`argv`
,
output
,
returncode
))
c
.
commit
()
if
sqlite3
is
None
:
def
record
(
argv
,
output
,
returncode
):
print
output
print
'returncode=%s'
%
returncode
else
:
def
record
(
argv
,
output
,
returncode
):
print
"saving %s bytes of output; returncode=%s"
%
(
len
(
output
),
returncode
)
path
=
get_results_db
()
c
=
sqlite3
.
connect
(
path
)
c
.
execute
(
'''create table if not exists testresult
(id integer primary key autoincrement,
command text,
output text,
exitcode integer)'''
)
c
.
execute
(
'insert into testresult (command, output, exitcode)'
'values (?, ?, ?)'
,
(
`argv`
,
output
,
returncode
))
c
.
commit
()
def
main
():
argv
=
sys
.
argv
[
1
:]
...
...
@@ -69,7 +82,6 @@ def main():
print
arg
p
=
subprocess
.
Popen
(
argv
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
)
returncode
=
p
.
wait
()
print
arg
,
'finished with code'
,
returncode
output
=
p
.
stdout
.
read
()
if
not
debug
:
if
returncode
==
1
:
...
...
@@ -77,7 +89,6 @@ def main():
elif
returncode
==
8
and
disabled_marker
in
output
:
pass
else
:
print
"saving %s bytes of output"
%
len
(
output
)
record
(
argv
,
output
,
returncode
)
sys
.
exit
(
returncode
)
...
...
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