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__ = [
try
:
terrain
=
fs
.
FileSystem
.
_import
(
"terrain"
)
reload
(
terrain
)
except
Exception
,
e
:
except
Exception
as
e
:
if
not
"No module named terrain"
in
str
(
e
):
string
=
'Lettuce has tried to load the conventional environment '
\
'module "terrain"
\n
but it has errors, check its contents and '
\
...
...
@@ -161,7 +161,7 @@ class Runner(object):
# that we don't even want to test.
try
:
self
.
loader
.
find_and_load_step_definitions
()
except
StepLoadingError
,
e
:
except
StepLoadingError
as
e
:
print
"Error loading step definitions:
\n
"
,
e
return
...
...
lettuce/core.py
View file @
ead2993f
...
...
@@ -143,7 +143,7 @@ class StepDefinition(object):
try
:
ret
=
self
.
function
(
self
.
step
,
*
args
,
**
kw
)
self
.
step
.
passed
=
True
except
Exception
,
e
:
except
Exception
as
e
:
self
.
step
.
failed
=
True
self
.
step
.
why
=
ReasonToFail
(
self
.
step
,
e
)
raise
...
...
@@ -479,10 +479,10 @@ class Step(object):
step
.
run
(
ignore_case
)
steps_passed
.
append
(
step
)
except
NoDefinitionFound
,
e
:
except
NoDefinitionFound
as
e
:
steps_undefined
.
append
(
e
.
step
)
except
Exception
,
e
:
except
Exception
as
e
:
steps_failed
.
append
(
step
)
reasons_to_fail
.
append
(
step
.
why
)
if
failfast
:
...
...
@@ -885,7 +885,7 @@ class Background(object):
call_hook
(
'before_each'
,
'step'
,
step
)
try
:
results
.
append
(
step
.
run
(
ignore_case
))
except
Exception
,
e
:
except
Exception
as
e
:
print
e
pass
...
...
lettuce/django/management/commands/harvest.py
View file @
ead2993f
...
...
@@ -162,7 +162,7 @@ class Command(BaseCommand):
if
run_server
:
try
:
server
.
start
()
except
LettuceServerException
,
e
:
except
LettuceServerException
as
e
:
raise
SystemExit
(
e
)
os
.
environ
[
'SERVER_NAME'
]
=
str
(
server
.
address
)
...
...
@@ -196,10 +196,10 @@ class Command(BaseCommand):
results
.
append
(
result
)
if
not
result
or
result
.
steps
!=
result
.
steps_passed
:
failed
=
True
except
SystemExit
,
e
:
except
SystemExit
as
e
:
failed
=
e
.
code
except
Exception
,
e
:
except
Exception
as
e
:
failed
=
True
import
traceback
traceback
.
print_exc
(
e
)
...
...
lettuce/fs.py
View file @
ead2993f
...
...
@@ -48,7 +48,7 @@ class FeatureLoader(object):
to_load
=
FileSystem
.
filename
(
filename
,
with_extension
=
False
)
try
:
module
=
__import__
(
to_load
)
except
ValueError
,
e
:
except
ValueError
as
e
:
import
traceback
err_msg
=
traceback
.
format_exc
(
e
)
if
'empty module name'
in
err_msg
.
lower
():
...
...
@@ -144,7 +144,7 @@ class FileSystem(object):
"""
try
:
os
.
makedirs
(
path
)
except
OSError
,
e
:
except
OSError
as
e
:
# ignore if path already exists
if
e
.
errno
not
in
(
17
,
):
raise
e
...
...
lettuce/registry.py
View file @
ead2993f
...
...
@@ -133,7 +133,7 @@ def call_hook(situation, kind, *args, **kw):
for
callback
in
CALLBACK_REGISTRY
[
kind
][
situation
]:
try
:
callback
(
*
args
,
**
kw
)
except
Exception
,
e
:
except
Exception
as
e
:
print
"="
*
1000
traceback
.
print_exc
(
e
)
print
...
...
tests/integration/django/chive/features/step_definitions/steps.py
View file @
ead2993f
...
...
@@ -12,7 +12,7 @@ def get_url(url):
try
:
world
.
last_response
=
urllib2
.
urlopen
(
url
)
except
Exception
,
e
:
except
Exception
as
e
:
world
.
last_response
=
e
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):
try
:
world
.
last_response
=
urllib2
.
urlopen
(
url
)
except
Exception
,
e
:
except
Exception
as
e
:
world
.
last_response
=
e
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():
try
:
step
.
hashes
.
first
failed
=
False
except
AssertionError
,
e
:
except
AssertionError
as
e
:
failed
=
True
assert_equals
(
unicode
(
e
),
...
...
@@ -253,7 +253,7 @@ def test_hashes__last_attr_raises_assertion_error_if_empty():
try
:
step
.
hashes
.
last
failed
=
False
except
AssertionError
,
e
:
except
AssertionError
as
e
:
failed
=
True
assert_equals
(
unicode
(
e
),
...
...
@@ -276,7 +276,7 @@ def test_handy_function_for_table_members_fail_giving_assertionerror():
try
:
step
.
hashes
.
values_under
(
'Foobar'
)
failed
=
False
except
AssertionError
,
e
:
except
AssertionError
as
e
:
failed
=
True
assert_equals
(
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