Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cloudooo
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
Tristan Cavelier
cloudooo
Commits
8c0efdc7
Commit
8c0efdc7
authored
Jun 08, 2011
by
Priscila Manhaes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor to auto select with handler test belongs to
parent
a95df145
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
cloudooo/tests/runHandlerUnitTest.py
cloudooo/tests/runHandlerUnitTest.py
+13
-13
No files found.
cloudooo/tests/runHandlerUnitTest.py
View file @
8c0efdc7
...
@@ -8,6 +8,7 @@ from subprocess import Popen
...
@@ -8,6 +8,7 @@ from subprocess import Popen
from
ConfigParser
import
ConfigParser
from
ConfigParser
import
ConfigParser
from
argparse
import
ArgumentParser
from
argparse
import
ArgumentParser
from
os
import
chdir
,
path
,
environ
,
curdir
,
remove
from
os
import
chdir
,
path
,
environ
,
curdir
,
remove
from
glob
import
glob
import
psutil
import
psutil
from
cloudooo.handler.ooo.util
import
socketStatus
from
cloudooo.handler.ooo.util
import
socketStatus
from
signal
import
SIGQUIT
from
signal
import
SIGQUIT
...
@@ -38,12 +39,9 @@ def run():
...
@@ -38,12 +39,9 @@ def run():
parser
.
add_argument
(
'--paster_path'
,
dest
=
'paster_path'
,
parser
.
add_argument
(
'--paster_path'
,
dest
=
'paster_path'
,
default
=
'paster'
,
default
=
'paster'
,
help
=
"Path to Paster script"
)
help
=
"Path to Paster script"
)
parser
.
add_argument
(
'--handler'
,
dest
=
'handler'
,
type
=
str
,
help
=
"Cloudooo's Handler'"
)
namespace
=
parser
.
parse_args
()
namespace
=
parser
.
parse_args
()
environment_path
=
resource_filename
(
"cloudooo.handler.%s"
%
namespace
.
handler
,
environment_path
=
glob
(
path
.
join
(
resource_filename
(
"cloudooo"
,
"handler"
),
'*'
,
'tests'
))
"/tests"
)
sys
.
path
.
extend
(
environment_path
)
server_cloudooo_conf
=
namespace
.
server_cloudooo_conf
server_cloudooo_conf
=
namespace
.
server_cloudooo_conf
test_name
=
namespace
.
test_name
test_name
=
namespace
.
test_name
if
server_cloudooo_conf
.
startswith
(
curdir
):
if
server_cloudooo_conf
.
startswith
(
curdir
):
...
@@ -55,16 +53,18 @@ def run():
...
@@ -55,16 +53,18 @@ def run():
python_extension
=
'.py'
python_extension
=
'.py'
if
test_name
[
-
3
:]
==
python_extension
:
if
test_name
[
-
3
:]
==
python_extension
:
test_name
=
test_name
[:
-
3
]
test_name
=
test_name
[:
-
3
]
full_path
=
path
.
join
(
environment_path
,
'%s%s'
%
(
test_name
,
for
env_handler_path
in
environment_path
:
full_path
=
path
.
join
(
env_handler_path
,
'%s%s'
%
(
test_name
,
python_extension
))
python_extension
))
if
not
path
.
exists
(
full_path
):
if
path
.
exists
(
full_path
):
exit
(
"%s does not exists
\
n
"
%
full_path
)
handler_path
=
env_handler_path
break
else
:
exit
(
"%s does not exists
\
n
"
%
full_path
)
from
cloudooo.tests.handlerTestCase
import
startFakeEnvironment
from
cloudooo.tests.handlerTestCase
import
startFakeEnvironment
from
cloudooo.tests.handlerTestCase
import
stopFakeEnvironment
from
cloudooo.tests.handlerTestCase
import
stopFakeEnvironment
sys
.
path
.
append
(
environment_path
)
config
=
ConfigParser
()
config
=
ConfigParser
()
config
.
read
(
server_cloudooo_conf
)
config
.
read
(
server_cloudooo_conf
)
module
=
__import__
(
test_name
)
module
=
__import__
(
test_name
)
...
@@ -87,19 +87,19 @@ def run():
...
@@ -87,19 +87,19 @@ def run():
server_cloudooo_conf
]
server_cloudooo_conf
]
process
=
Popen
(
command
)
process
=
Popen
(
command
)
wait_use_port
(
process
.
pid
)
wait_use_port
(
process
.
pid
)
chdir
(
environment
_path
)
chdir
(
handler
_path
)
try
:
try
:
TestRunner
(
verbosity
=
2
).
run
(
suite
)
TestRunner
(
verbosity
=
2
).
run
(
suite
)
finally
:
finally
:
process
.
send_signal
(
SIGQUIT
)
process
.
send_signal
(
SIGQUIT
)
process
.
wait
()
process
.
wait
()
elif
OPENOFFICE
:
elif
OPENOFFICE
:
chdir
(
environment
_path
)
chdir
(
handler
_path
)
startFakeEnvironment
(
conf_path
=
server_cloudooo_conf
)
startFakeEnvironment
(
conf_path
=
server_cloudooo_conf
)
try
:
try
:
TestRunner
(
verbosity
=
2
).
run
(
suite
)
TestRunner
(
verbosity
=
2
).
run
(
suite
)
finally
:
finally
:
stopFakeEnvironment
()
stopFakeEnvironment
()
else
:
else
:
chdir
(
environment
_path
)
chdir
(
handler
_path
)
TestRunner
(
verbosity
=
2
).
run
(
suite
)
TestRunner
(
verbosity
=
2
).
run
(
suite
)
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