Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lettuce
Overview
Overview
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
lettuce
Commits
b2e61d5c
Commit
b2e61d5c
authored
Jun 12, 2012
by
Gabriel Falcao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
the harvest command now takes a --port argument. closes #214
parent
5e4e9df4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
14 deletions
+48
-14
lettuce/django/management/commands/harvest.py
+6
-1
tests/integration/django/cucumber/terrain.py
+1
-13
tests/integration/test_alfaces.py
+41
-0
No files found.
lettuce/django/management/commands/harvest.py
View file @
b2e61d5c
...
...
@@ -25,7 +25,7 @@ from django.test.utils import teardown_test_environment
from
lettuce
import
Runner
from
lettuce
import
registry
from
lettuce.django
import
s
erver
from
lettuce.django
.server
import
S
erver
from
lettuce.django
import
harvest_lettuces
from
lettuce.django.server
import
LettuceServerException
...
...
@@ -49,6 +49,9 @@ class Command(BaseCommand):
make_option
(
'-S'
,
'--no-server'
,
action
=
'store_true'
,
dest
=
'no_server'
,
default
=
False
,
help
=
"will not run django's builtin HTTP server"
),
make_option
(
'-P'
,
'--port'
,
type
=
'int'
,
dest
=
'port'
,
help
=
"the port in which the HTTP server will run at"
),
make_option
(
'-d'
,
'--debug-mode'
,
action
=
'store_true'
,
dest
=
'debug'
,
default
=
False
,
help
=
"when put together with builtin HTTP server, forces django to run with settings.DEBUG=True"
),
...
...
@@ -98,6 +101,8 @@ class Command(BaseCommand):
apps_to_avoid
=
tuple
(
options
.
get
(
'avoid_apps'
,
''
)
.
split
(
","
))
run_server
=
not
options
.
get
(
'no_server'
,
False
)
tags
=
options
.
get
(
'tags'
,
None
)
server
=
Server
(
port
=
options
[
'port'
])
if
tags
:
print
"DEBUG"
,
options
...
...
tests/integration/django/cucumber/terrain.py
View file @
b2e61d5c
...
...
@@ -7,20 +7,8 @@ from nose.tools import assert_equals
@before.harvest
def
before_harvest
(
variables
):
assert_equals
(
variables
.
keys
(),
[
'paths'
,
'args'
,
'failed'
,
'run_server'
,
'verbosity'
,
'tags'
,
'self'
,
'apps_to_run'
,
'apps_to_avoid'
,
'options'
,
],
)
print
"before harvest"
@after.harvest
def
after_harvest
(
results
):
assert_equals
(
len
(
results
),
2
)
...
...
tests/integration/test_alfaces.py
View file @
b2e61d5c
...
...
@@ -79,6 +79,47 @@ def test_django_background_server_running_in_background():
FileSystem
.
popd
()
def
test_django_background_server_running_in_background_with_custom_port
():
'the harvest command should take a --port argument'
FileSystem
.
pushd
(
current_directory
,
"django"
,
"alfaces"
)
import
tornado.ioloop
import
tornado.web
class
MainHandler
(
tornado
.
web
.
RequestHandler
):
def
get
(
self
):
self
.
write
(
"Hello, world"
)
raise
SystemExit
()
def
runserver
():
application
=
tornado
.
web
.
Application
([
(
r"/"
,
MainHandler
),
])
application
.
listen
(
9889
)
tornado
.
ioloop
.
IOLoop
.
instance
()
.
start
()
server
=
multiprocessing
.
Process
(
target
=
runserver
)
server
.
start
()
time
.
sleep
(
1
)
# the child process take some time to get up
e
=
'Lettuce could not run the builtin Django server at 0.0.0.0:9889"
\n
'
\
'maybe you forgot a "runserver" instance running ?
\n\n
'
\
'well if you really do not want lettuce to run the server '
\
'for you, then just run:
\n\n
'
\
'python manage.py --no-server'
try
:
status
,
out
=
commands
.
getstatusoutput
(
"python manage.py harvest --verbosity=3 --port=9889"
)
assert_equals
(
out
,
e
)
assert_not_equals
(
status
,
0
)
finally
:
os
.
kill
(
server
.
pid
,
9
)
FileSystem
.
popd
()
def
test_limit_by_app_getting_all_apps_by_comma
():
'running "harvest" with --apps=multiple,apps,separated,by,comma'
...
...
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