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
0e25b164
Commit
0e25b164
authored
Nov 18, 2010
by
Gabriel Falcão
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improving the import error for terrain.py and bumping to 0.1.16
parent
58c5c3f4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
13 deletions
+32
-13
README.md
+1
-1
lettuce/__init__.py
+6
-5
tests/functional/test_runner.py
+17
-4
tests/unit/test_main.py
+8
-3
No files found.
README.md
View file @
0e25b164
# lettuce
# lettuce
> Version 0.1.1
5
- barium
> Version 0.1.1
6
- barium
## On release names
## On release names
...
...
lettuce/__init__.py
View file @
0e25b164
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
version
=
'0.1.1
5
'
version
=
'0.1.1
6
'
release
=
'barium'
release
=
'barium'
import
os
import
os
...
@@ -35,7 +35,7 @@ from lettuce.registry import call_hook
...
@@ -35,7 +35,7 @@ from lettuce.registry import call_hook
from
lettuce.registry
import
STEP_REGISTRY
from
lettuce.registry
import
STEP_REGISTRY
from
lettuce.registry
import
CALLBACK_REGISTRY
from
lettuce.registry
import
CALLBACK_REGISTRY
from
lettuce
.exceptions
import
LettuceSyntaxError
from
lettuce
import
exceptions
__all__
=
[
'after'
,
'before'
,
'step'
,
'world'
,
'STEP_REGISTRY'
,
'CALLBACK_REGISTRY'
,
'call_hook'
]
__all__
=
[
'after'
,
'before'
,
'step'
,
'world'
,
'STEP_REGISTRY'
,
'CALLBACK_REGISTRY'
,
'call_hook'
]
...
@@ -46,11 +46,12 @@ except Exception, e:
...
@@ -46,11 +46,12 @@ except Exception, 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 '
\
'try to run lettuce again.
\n
'
'try to run lettuce again.
\n\n
Original traceback below:
\n\n
'
sys
.
stderr
.
write
(
string
)
sys
.
stderr
.
write
(
string
)
sys
.
stderr
.
write
(
exceptions
.
traceback
.
format_exc
(
e
))
raise
SystemExit
(
1
)
raise
SystemExit
(
1
)
class
Runner
(
object
):
class
Runner
(
object
):
""" Main lettuce's test runner
""" Main lettuce's test runner
...
@@ -109,7 +110,7 @@ class Runner(object):
...
@@ -109,7 +110,7 @@ class Runner(object):
for
filename
in
features_files
:
for
filename
in
features_files
:
feature
=
Feature
.
from_file
(
filename
)
feature
=
Feature
.
from_file
(
filename
)
results
.
append
(
feature
.
run
(
self
.
scenarios
))
results
.
append
(
feature
.
run
(
self
.
scenarios
))
except
LettuceSyntaxError
,
e
:
except
exceptions
.
LettuceSyntaxError
,
e
:
sys
.
stderr
.
write
(
e
.
msg
)
sys
.
stderr
.
write
(
e
.
msg
)
failed
=
True
failed
=
True
...
...
tests/functional/test_runner.py
View file @
0e25b164
...
@@ -18,7 +18,7 @@ import os
...
@@ -18,7 +18,7 @@ import os
import
lettuce
import
lettuce
from
StringIO
import
StringIO
from
StringIO
import
StringIO
from
os.path
import
dirname
,
abspath
,
join
from
os.path
import
dirname
,
join
,
abspath
from
nose.tools
import
assert_equals
,
with_setup
,
assert_raises
from
nose.tools
import
assert_equals
,
with_setup
,
assert_raises
from
lettuce.fs
import
FeatureLoader
from
lettuce.fs
import
FeatureLoader
from
lettuce.core
import
Feature
,
fs
,
StepDefinition
from
lettuce.core
import
Feature
,
fs
,
StepDefinition
...
@@ -59,10 +59,23 @@ def test_try_to_import_terrain():
...
@@ -59,10 +59,23 @@ def test_try_to_import_terrain():
reload
(
lettuce
)
reload
(
lettuce
)
raise
AssertionError
(
'The runner should raise ImportError !'
)
raise
AssertionError
(
'The runner should raise ImportError !'
)
except
SystemExit
:
except
SystemExit
:
assert_stderr
(
assert_stderr
_lines
(
'Lettuce has tried to load the conventional environment module '
\
'Lettuce has tried to load the conventional environment module '
\
'"terrain"
\n
'
'"terrain"
\n
but it has errors, check its contents and '
\
'but it has errors, check its contents and try to run lettuce again.
\n
'
'try to run lettuce again.
\n\n
Original traceback below:
\n\n
'
\
"Traceback (most recent call last):
\n
"
' File "
%(lettuce_core_file)
s", line 43, in <module>
\n
'
' terrain = fs.FileSystem._import("terrain")
\n
'
\
' File "
%(lettuce_fs_file)
s", line 63, in _import
\n
'
\
' module = imp.load_module(name, fp, pathname, description)
\n
'
\
' File "
%(terrain_file)
s", line 18
\n
'
\
' it is here just to cause a syntax error
\n
'
\
" ^
\n
"
\
'SyntaxError: invalid syntax
\n
'
%
{
'lettuce_core_file'
:
abspath
(
join
(
lettuce_dir
,
'__init__.py'
)),
'lettuce_fs_file'
:
abspath
(
join
(
lettuce_dir
,
'fs.py'
)),
'terrain_file'
:
abspath
(
lettuce_path
(
'..'
,
'tests'
,
'functional'
,
'sandbox'
,
'terrain.py'
)),
}
)
)
finally
:
finally
:
...
...
tests/unit/test_main.py
View file @
0e25b164
...
@@ -21,7 +21,7 @@ from mox import Mox
...
@@ -21,7 +21,7 @@ from mox import Mox
def
test_has_version
():
def
test_has_version
():
"A nice python module is supposed to have a version"
"A nice python module is supposed to have a version"
assert_equals
(
lettuce
.
version
,
'0.1.1
5
'
)
assert_equals
(
lettuce
.
version
,
'0.1.1
6
'
)
def
test_import
():
def
test_import
():
"lettuce importer does import"
"lettuce importer does import"
...
@@ -31,18 +31,23 @@ def test_import():
...
@@ -31,18 +31,23 @@ def test_import():
def
test_terrain_import_exception
():
def
test_terrain_import_exception
():
"lettuce error tries to import "
"lettuce error tries to import "
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 '
\
'try to run lettuce again.
\n
'
'try to run lettuce again.
\n
\n
Original traceback below:
\n\n
'
mox
=
Mox
()
mox
=
Mox
()
mox
.
StubOutWithMock
(
lettuce
.
fs
,
'FileSystem'
)
mox
.
StubOutWithMock
(
lettuce
.
fs
,
'FileSystem'
)
mox
.
StubOutWithMock
(
lettuce
.
exceptions
,
'traceback'
)
mox
.
StubOutWithMock
(
lettuce
.
sys
,
'stderr'
)
mox
.
StubOutWithMock
(
lettuce
.
sys
,
'stderr'
)
lettuce
.
fs
.
FileSystem
.
_import
(
'terrain'
)
.
AndRaise
(
Exception
(
'foo bar'
))
exc
=
Exception
(
'foo bar'
)
lettuce
.
fs
.
FileSystem
.
_import
(
'terrain'
)
.
AndRaise
(
exc
)
lettuce
.
exceptions
.
traceback
.
format_exc
(
exc
)
.
AndReturn
(
'I AM THE TRACEBACK FOR IMPORT ERROR'
)
lettuce
.
sys
.
stderr
.
write
(
string
)
lettuce
.
sys
.
stderr
.
write
(
string
)
lettuce
.
sys
.
stderr
.
write
(
'I AM THE TRACEBACK FOR IMPORT ERROR'
)
mox
.
ReplayAll
()
mox
.
ReplayAll
()
...
...
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