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
ead2993f
Commit
ead2993f
authored
Jul 22, 2015
by
Michel Sabchuk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #476, change the syntax of caught exceptions.
parent
19e6f8cd
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
17 additions
and
17 deletions
+17
-17
lettuce/__init__.py
+2
-2
lettuce/core.py
+4
-4
lettuce/django/management/commands/harvest.py
+3
-3
lettuce/fs.py
+2
-2
lettuce/registry.py
+1
-1
tests/integration/django/chive/features/step_definitions/steps.py
+1
-1
tests/integration/django/grocery/features/step_definitions/grocery_steps.py
+1
-1
tests/unit/test_step_parsing.py
+3
-3
No files found.
lettuce/__init__.py
View file @
ead2993f
...
@@ -71,7 +71,7 @@ __all__ = [
...
@@ -71,7 +71,7 @@ __all__ = [
try
:
try
:
terrain
=
fs
.
FileSystem
.
_import
(
"terrain"
)
terrain
=
fs
.
FileSystem
.
_import
(
"terrain"
)
reload
(
terrain
)
reload
(
terrain
)
except
Exception
,
e
:
except
Exception
as
e
:
if
not
"No module named terrain"
in
str
(
e
):
if
not
"No module named terrain"
in
str
(
e
):
string
=
'Lettuce has tried to load the conventional environment '
\
string
=
'Lettuce has tried to load the conventional environment '
\
'module "terrain"
\n
but it has errors, check its contents and '
\
'module "terrain"
\n
but it has errors, check its contents and '
\
...
@@ -161,7 +161,7 @@ class Runner(object):
...
@@ -161,7 +161,7 @@ class Runner(object):
# that we don't even want to test.
# that we don't even want to test.
try
:
try
:
self
.
loader
.
find_and_load_step_definitions
()
self
.
loader
.
find_and_load_step_definitions
()
except
StepLoadingError
,
e
:
except
StepLoadingError
as
e
:
print
"Error loading step definitions:
\n
"
,
e
print
"Error loading step definitions:
\n
"
,
e
return
return
...
...
lettuce/core.py
View file @
ead2993f
...
@@ -143,7 +143,7 @@ class StepDefinition(object):
...
@@ -143,7 +143,7 @@ class StepDefinition(object):
try
:
try
:
ret
=
self
.
function
(
self
.
step
,
*
args
,
**
kw
)
ret
=
self
.
function
(
self
.
step
,
*
args
,
**
kw
)
self
.
step
.
passed
=
True
self
.
step
.
passed
=
True
except
Exception
,
e
:
except
Exception
as
e
:
self
.
step
.
failed
=
True
self
.
step
.
failed
=
True
self
.
step
.
why
=
ReasonToFail
(
self
.
step
,
e
)
self
.
step
.
why
=
ReasonToFail
(
self
.
step
,
e
)
raise
raise
...
@@ -479,10 +479,10 @@ class Step(object):
...
@@ -479,10 +479,10 @@ class Step(object):
step
.
run
(
ignore_case
)
step
.
run
(
ignore_case
)
steps_passed
.
append
(
step
)
steps_passed
.
append
(
step
)
except
NoDefinitionFound
,
e
:
except
NoDefinitionFound
as
e
:
steps_undefined
.
append
(
e
.
step
)
steps_undefined
.
append
(
e
.
step
)
except
Exception
,
e
:
except
Exception
as
e
:
steps_failed
.
append
(
step
)
steps_failed
.
append
(
step
)
reasons_to_fail
.
append
(
step
.
why
)
reasons_to_fail
.
append
(
step
.
why
)
if
failfast
:
if
failfast
:
...
@@ -885,7 +885,7 @@ class Background(object):
...
@@ -885,7 +885,7 @@ class Background(object):
call_hook
(
'before_each'
,
'step'
,
step
)
call_hook
(
'before_each'
,
'step'
,
step
)
try
:
try
:
results
.
append
(
step
.
run
(
ignore_case
))
results
.
append
(
step
.
run
(
ignore_case
))
except
Exception
,
e
:
except
Exception
as
e
:
print
e
print
e
pass
pass
...
...
lettuce/django/management/commands/harvest.py
View file @
ead2993f
...
@@ -162,7 +162,7 @@ class Command(BaseCommand):
...
@@ -162,7 +162,7 @@ class Command(BaseCommand):
if
run_server
:
if
run_server
:
try
:
try
:
server
.
start
()
server
.
start
()
except
LettuceServerException
,
e
:
except
LettuceServerException
as
e
:
raise
SystemExit
(
e
)
raise
SystemExit
(
e
)
os
.
environ
[
'SERVER_NAME'
]
=
str
(
server
.
address
)
os
.
environ
[
'SERVER_NAME'
]
=
str
(
server
.
address
)
...
@@ -196,10 +196,10 @@ class Command(BaseCommand):
...
@@ -196,10 +196,10 @@ class Command(BaseCommand):
results
.
append
(
result
)
results
.
append
(
result
)
if
not
result
or
result
.
steps
!=
result
.
steps_passed
:
if
not
result
or
result
.
steps
!=
result
.
steps_passed
:
failed
=
True
failed
=
True
except
SystemExit
,
e
:
except
SystemExit
as
e
:
failed
=
e
.
code
failed
=
e
.
code
except
Exception
,
e
:
except
Exception
as
e
:
failed
=
True
failed
=
True
import
traceback
import
traceback
traceback
.
print_exc
(
e
)
traceback
.
print_exc
(
e
)
...
...
lettuce/fs.py
View file @
ead2993f
...
@@ -48,7 +48,7 @@ class FeatureLoader(object):
...
@@ -48,7 +48,7 @@ class FeatureLoader(object):
to_load
=
FileSystem
.
filename
(
filename
,
with_extension
=
False
)
to_load
=
FileSystem
.
filename
(
filename
,
with_extension
=
False
)
try
:
try
:
module
=
__import__
(
to_load
)
module
=
__import__
(
to_load
)
except
ValueError
,
e
:
except
ValueError
as
e
:
import
traceback
import
traceback
err_msg
=
traceback
.
format_exc
(
e
)
err_msg
=
traceback
.
format_exc
(
e
)
if
'empty module name'
in
err_msg
.
lower
():
if
'empty module name'
in
err_msg
.
lower
():
...
@@ -144,7 +144,7 @@ class FileSystem(object):
...
@@ -144,7 +144,7 @@ class FileSystem(object):
"""
"""
try
:
try
:
os
.
makedirs
(
path
)
os
.
makedirs
(
path
)
except
OSError
,
e
:
except
OSError
as
e
:
# ignore if path already exists
# ignore if path already exists
if
e
.
errno
not
in
(
17
,
):
if
e
.
errno
not
in
(
17
,
):
raise
e
raise
e
...
...
lettuce/registry.py
View file @
ead2993f
...
@@ -133,7 +133,7 @@ def call_hook(situation, kind, *args, **kw):
...
@@ -133,7 +133,7 @@ def call_hook(situation, kind, *args, **kw):
for
callback
in
CALLBACK_REGISTRY
[
kind
][
situation
]:
for
callback
in
CALLBACK_REGISTRY
[
kind
][
situation
]:
try
:
try
:
callback
(
*
args
,
**
kw
)
callback
(
*
args
,
**
kw
)
except
Exception
,
e
:
except
Exception
as
e
:
print
"="
*
1000
print
"="
*
1000
traceback
.
print_exc
(
e
)
traceback
.
print_exc
(
e
)
print
print
...
...
tests/integration/django/chive/features/step_definitions/steps.py
View file @
ead2993f
...
@@ -12,7 +12,7 @@ def get_url(url):
...
@@ -12,7 +12,7 @@ def get_url(url):
try
:
try
:
world
.
last_response
=
urllib2
.
urlopen
(
url
)
world
.
last_response
=
urllib2
.
urlopen
(
url
)
except
Exception
,
e
:
except
Exception
as
e
:
world
.
last_response
=
e
world
.
last_response
=
e
return
world
.
last_response
return
world
.
last_response
...
...
tests/integration/django/grocery/features/step_definitions/grocery_steps.py
View file @
ead2993f
...
@@ -14,7 +14,7 @@ def get_url(url):
...
@@ -14,7 +14,7 @@ def get_url(url):
try
:
try
:
world
.
last_response
=
urllib2
.
urlopen
(
url
)
world
.
last_response
=
urllib2
.
urlopen
(
url
)
except
Exception
,
e
:
except
Exception
as
e
:
world
.
last_response
=
e
world
.
last_response
=
e
return
world
.
last_response
return
world
.
last_response
...
...
tests/unit/test_step_parsing.py
View file @
ead2993f
...
@@ -226,7 +226,7 @@ def test_hashes__first_attr_raises_assertion_error_if_empty():
...
@@ -226,7 +226,7 @@ def test_hashes__first_attr_raises_assertion_error_if_empty():
try
:
try
:
step
.
hashes
.
first
step
.
hashes
.
first
failed
=
False
failed
=
False
except
AssertionError
,
e
:
except
AssertionError
as
e
:
failed
=
True
failed
=
True
assert_equals
(
assert_equals
(
unicode
(
e
),
unicode
(
e
),
...
@@ -253,7 +253,7 @@ def test_hashes__last_attr_raises_assertion_error_if_empty():
...
@@ -253,7 +253,7 @@ def test_hashes__last_attr_raises_assertion_error_if_empty():
try
:
try
:
step
.
hashes
.
last
step
.
hashes
.
last
failed
=
False
failed
=
False
except
AssertionError
,
e
:
except
AssertionError
as
e
:
failed
=
True
failed
=
True
assert_equals
(
assert_equals
(
unicode
(
e
),
unicode
(
e
),
...
@@ -276,7 +276,7 @@ def test_handy_function_for_table_members_fail_giving_assertionerror():
...
@@ -276,7 +276,7 @@ def test_handy_function_for_table_members_fail_giving_assertionerror():
try
:
try
:
step
.
hashes
.
values_under
(
'Foobar'
)
step
.
hashes
.
values_under
(
'Foobar'
)
failed
=
False
failed
=
False
except
AssertionError
,
e
:
except
AssertionError
as
e
:
failed
=
True
failed
=
True
assert_equals
(
assert_equals
(
unicode
(
e
),
unicode
(
e
),
...
...
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