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
e4aa0f6f
Commit
e4aa0f6f
authored
Apr 03, 2010
by
Gabriel Falcão
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finding feature files on given dir
parent
9d8bca20
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
110 additions
and
0 deletions
+110
-0
Makefile
+6
-0
lettuce/fs.py
+31
-0
tests/functional/1st_feature_dir/more_features_here/another.feature
+10
-0
tests/functional/1st_feature_dir/one_more.feature
+10
-0
tests/functional/1st_feature_dir/some.feature
+17
-0
tests/functional/__init__.py
+0
-0
tests/functional/test_feature_finder.py
+36
-0
No files found.
Makefile
View file @
e4aa0f6f
all
:
unit functional
unit
:
@
echo
"Running unit tests ..."
@
nosetests
-s
--verbosity
=
2
--with-coverage
--cover-inclusive
tests/unit/
functional
:
@
echo
"Running functional tests ..."
@
nosetests
-s
--verbosity
=
2
--with-coverage
--cover-inclusive
tests/functional/
clean
:
@
echo
-n
"Cleaning up files that are already in .gitignore... "
@
for
pattern
in
`
cat
.gitignore
`
;
do
find
.
-name
"
$$
pattern"
-exec
rm
-rf
{}
\;
;
done
...
...
lettuce/fs.py
0 → 100644
View file @
e4aa0f6f
# -*- coding: utf-8 -*-
# <Lettuce - Behaviour Driven Development for python>
# Copyright (C) <2010> Gabriel Falcão <gabriel@nacaolivre.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from
os
import
walk
from
os.path
import
dirname
,
abspath
,
join
class
FeatureFinder
(
object
):
def
__init__
(
self
,
base_dir
):
self
.
base_dir
=
abspath
(
base_dir
)
def
find_feature_files
(
self
):
paths
=
[]
for
root
,
dirs
,
files
in
walk
(
self
.
base_dir
):
for
filename
in
files
:
if
filename
.
endswith
(
".feature"
):
path
=
join
(
root
,
filename
)
paths
.
append
(
path
)
return
paths
tests/functional/1st_feature_dir/more_features_here/another.feature
0 → 100644
View file @
e4aa0f6f
# language: en
Feature
:
Division
In order to avoid silly mistakes
Cashiers must be able to calculate a fraction
Scenario
:
Regular numbers
*
I have entered 3 into the calculator
*
I have entered 2 into the calculator
*
I press divide
*
the result should be 1.5 on the screen
tests/functional/1st_feature_dir/one_more.feature
0 → 100644
View file @
e4aa0f6f
# language: en
Feature
:
Multiplication
In order to avoid silly mistakes
Cashiers must be able to multiplicate numbers
:
)
Scenario
:
Regular numbers
*
I have entered 10 into the calculator
*
I have entered 4 into the calculator
*
I press multiply
*
the result should be 40 on the screen
tests/functional/1st_feature_dir/some.feature
0 → 100644
View file @
e4aa0f6f
# language: en
Feature
:
Addition
In order to avoid silly mistakes
As a math idiot
I want to be told the sum of two numbers
Scenario Outline
:
Add two numbers
Given
I have entered
<input_1>
into the calculator
And
I have entered
<input_2>
into the calculator
When
I press
<button>
Then
the result should be
<output>
on the screen
Examples
:
|
input_1
|
input_2
|
button
|
output
|
|
20
|
30
|
add
|
50
|
|
2
|
5
|
add
|
7
|
|
0
|
40
|
add
|
40
|
tests/functional/__init__.py
0 → 100644
View file @
e4aa0f6f
tests/functional/test_feature_finder.py
0 → 100644
View file @
e4aa0f6f
# -*- coding: utf-8 -*-
# <Lettuce - Behaviour Driven Development for python>
# Copyright (C) <2010> Gabriel Falcão <gabriel@nacaolivre.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from
nose.tools
import
assert_equals
from
os.path
import
dirname
,
abspath
,
join
from
lettuce.fs
import
FeatureFinder
def
test_feature_finder_finds_all_feature_files_within_a_dir
():
"FeatureFinder finds all feature files within a directory"
current_dir
=
abspath
(
dirname
(
__file__
))
ff
=
FeatureFinder
(
current_dir
)
files
=
ff
.
find_feature_files
()
cjoin
=
lambda
*
x
:
join
(
current_dir
,
*
x
)
assert_equals
(
sorted
(
files
),
sorted
([
cjoin
(
'1st_feature_dir'
,
'one_more.feature'
),
cjoin
(
'1st_feature_dir'
,
'some.feature'
),
cjoin
(
'1st_feature_dir'
,
'more_features_here'
,
'another.feature'
),
])
)
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