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
7a04591c
Unverified
Commit
7a04591c
authored
May 09, 2018
by
Michael Youngstrom
Committed by
GitHub
May 09, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5 from edx/youngstrom/fix-args
Add feature argument to the harvest command
parents
31b0dfd8
ce23103f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
10 deletions
+13
-10
lettuce/django/management/commands/harvest.py
+10
-6
tests/functional/test_runner.py
+3
-4
No files found.
lettuce/django/management/commands/harvest.py
View file @
7a04591c
...
@@ -39,7 +39,6 @@ DJANGO_VERSION = StrictVersion(django.get_version())
...
@@ -39,7 +39,6 @@ DJANGO_VERSION = StrictVersion(django.get_version())
class
Command
(
BaseCommand
):
class
Command
(
BaseCommand
):
help
=
u'Run lettuce tests all along installed apps'
help
=
u'Run lettuce tests all along installed apps'
args
=
'[PATH to feature file or folder]'
if
DJANGO_VERSION
<
StrictVersion
(
'1.7'
):
if
DJANGO_VERSION
<
StrictVersion
(
'1.7'
):
requires_model_validation
=
False
requires_model_validation
=
False
...
@@ -49,6 +48,10 @@ class Command(BaseCommand):
...
@@ -49,6 +48,10 @@ class Command(BaseCommand):
def
add_arguments
(
self
,
parser
):
def
add_arguments
(
self
,
parser
):
parser
.
set_defaults
(
verbosity
=
3
)
# default verbosity is 3
parser
.
set_defaults
(
verbosity
=
3
)
# default verbosity is 3
parser
.
add_argument
(
parser
.
add_argument
(
'features'
,
nargs
=
'*'
,
metavar
=
'feature'
,
action
=
'store'
,
help
=
'Path to feature file or folder'
)
parser
.
add_argument
(
'-a'
,
'--apps'
,
action
=
'store'
,
dest
=
'apps'
,
default
=
''
,
'-a'
,
'--apps'
,
action
=
'store'
,
dest
=
'apps'
,
default
=
''
,
help
=
'Run ONLY the django apps that are listed here. Comma separated'
help
=
'Run ONLY the django apps that are listed here. Comma separated'
)
)
...
@@ -132,14 +135,14 @@ class Command(BaseCommand):
...
@@ -132,14 +135,14 @@ class Command(BaseCommand):
default
=
False
,
help
=
"Don't colorize the command output."
default
=
False
,
help
=
"Don't colorize the command output."
)
)
def
get_paths
(
self
,
arg
s
,
apps_to_run
,
apps_to_avoid
):
def
get_paths
(
self
,
feature
s
,
apps_to_run
,
apps_to_avoid
):
if
arg
s
:
if
feature
s
:
for
path
,
exists
in
zip
(
args
,
map
(
os
.
path
.
exists
,
arg
s
)):
for
path
,
exists
in
zip
(
features
,
map
(
os
.
path
.
exists
,
feature
s
)):
if
not
exists
:
if
not
exists
:
sys
.
stderr
.
write
(
"You passed the path '
%
s', but it does not exist.
\n
"
%
path
)
sys
.
stderr
.
write
(
"You passed the path '
%
s', but it does not exist.
\n
"
%
path
)
sys
.
exit
(
1
)
sys
.
exit
(
1
)
else
:
else
:
paths
=
arg
s
paths
=
feature
s
else
:
else
:
paths
=
harvest_lettuces
(
apps_to_run
,
apps_to_avoid
)
# list of tuples with (path, app_module)
paths
=
harvest_lettuces
(
apps_to_run
,
apps_to_avoid
)
# list of tuples with (path, app_module)
...
@@ -152,6 +155,7 @@ class Command(BaseCommand):
...
@@ -152,6 +155,7 @@ class Command(BaseCommand):
no_color
=
options
.
get
(
'no_color'
,
False
)
no_color
=
options
.
get
(
'no_color'
,
False
)
apps_to_run
=
tuple
(
options
[
'apps'
]
.
split
(
","
))
apps_to_run
=
tuple
(
options
[
'apps'
]
.
split
(
","
))
apps_to_avoid
=
tuple
(
options
[
'avoid_apps'
]
.
split
(
","
))
apps_to_avoid
=
tuple
(
options
[
'avoid_apps'
]
.
split
(
","
))
features
=
options
[
'features'
]
run_server
=
not
options
[
'no_server'
]
run_server
=
not
options
[
'no_server'
]
test_database
=
options
[
'test_database'
]
test_database
=
options
[
'test_database'
]
smtp_queue
=
options
[
'smtp_queue'
]
smtp_queue
=
options
[
'smtp_queue'
]
...
@@ -183,7 +187,7 @@ class Command(BaseCommand):
...
@@ -183,7 +187,7 @@ class Command(BaseCommand):
settings
.
DEBUG
=
options
.
get
(
'debug'
,
False
)
settings
.
DEBUG
=
options
.
get
(
'debug'
,
False
)
paths
=
self
.
get_paths
(
arg
s
,
apps_to_run
,
apps_to_avoid
)
paths
=
self
.
get_paths
(
feature
s
,
apps_to_run
,
apps_to_avoid
)
server
=
get_server
(
port
=
options
[
'port'
],
threading
=
threading
)
server
=
get_server
(
port
=
options
[
'port'
],
threading
=
threading
)
if
run_server
:
if
run_server
:
...
...
tests/functional/test_runner.py
View file @
7a04591c
...
@@ -1276,7 +1276,7 @@ def test_output_background_with_success_colorless():
...
@@ -1276,7 +1276,7 @@ def test_output_background_with_success_colorless():
' Given the variable "X" holds 2 # tests/functional/test_runner.py:{line}
\n
'
' Given the variable "X" holds 2 # tests/functional/test_runner.py:{line}
\n
'
'
\n
'
'
\n
'
' Scenario: multiplication changing the value # tests/functional/bg_features/simple/simple.feature:9
\n
'
' Scenario: multiplication changing the value # tests/functional/bg_features/simple/simple.feature:9
\n
'
' Given the variable "X" is equal to 2 # tests/functional/
bg_features/simple/steps.py:5
\n
'
' Given the variable "X" is equal to 2 # tests/functional/
test_runner.py:{line}
\n
'
'
\n
'
'
\n
'
'1 feature (1 passed)
\n
'
'1 feature (1 passed)
\n
'
'1 scenario (1 passed)
\n
'
'1 scenario (1 passed)
\n
'
...
@@ -1314,8 +1314,8 @@ def test_output_background_with_success_colorful():
...
@@ -1314,8 +1314,8 @@ def test_output_background_with_success_colorful():
'
\033
[A
\033
[1;32m Given the variable "X" holds 2
\033
[1;30m# tests/functional/test_runner.py:{line}
\033
[0m
\n
'
'
\033
[A
\033
[1;32m Given the variable "X" holds 2
\033
[1;30m# tests/functional/test_runner.py:{line}
\033
[0m
\n
'
'
\n
'
'
\n
'
'
\033
[1;37m Scenario: multiplication changing the value
\033
[1;30m# tests/functional/bg_features/simple/simple.feature:9
\033
[0m
\n
'
'
\033
[1;37m Scenario: multiplication changing the value
\033
[1;30m# tests/functional/bg_features/simple/simple.feature:9
\033
[0m
\n
'
'
\033
[1;30m Given the variable "X" is equal to 2
\033
[1;30m# tests/functional/
bg_features/simple/steps.py:5
\033
[0m
\n
'
'
\033
[1;30m Given the variable "X" is equal to 2
\033
[1;30m# tests/functional/
test_runner.py:{line}
\033
[0m
\n
'
'
\033
[A
\033
[1;32m Given the variable "X" is equal to 2
\033
[1;30m# tests/functional/
bg_features/simple/steps.py:5
\033
[0m
\n
'
'
\033
[A
\033
[1;32m Given the variable "X" is equal to 2
\033
[1;30m# tests/functional/
test_runner.py:{line}
\033
[0m
\n
'
'
\n
'
'
\n
'
'
\033
[1;37m1 feature (
\033
[1;32m1 passed
\033
[1;37m)
\033
[0m
\n
'
'
\033
[1;37m1 feature (
\033
[1;32m1 passed
\033
[1;37m)
\033
[0m
\n
'
'
\033
[1;37m1 scenario (
\033
[1;32m1 passed
\033
[1;37m)
\033
[0m
\n
'
'
\033
[1;37m1 scenario (
\033
[1;32m1 passed
\033
[1;37m)
\033
[0m
\n
'
...
@@ -1446,4 +1446,3 @@ def test_output_with_undefined_steps_colorful():
...
@@ -1446,4 +1446,3 @@ def test_output_with_undefined_steps_colorful():
'def when_this_test_step_is_undefined(step):
\n
'
'def when_this_test_step_is_undefined(step):
\n
'
" assert False, 'This step must be implemented'
\x1b
[0m
\n
"
" assert False, 'This step must be implemented'
\x1b
[0m
\n
"
)
)
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