Skip to content

Commit

Permalink
Merge remote-tracking branch 'gabrielfalcao/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
akaihola committed Nov 16, 2012
2 parents 74037a1 + 36ffa10 commit 4539b44
Show file tree
Hide file tree
Showing 40 changed files with 1,087 additions and 196 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
language: python
python:
- "2.5"
- "2.6"
- "2.7"
# command to install dependencies
Expand Down
15 changes: 15 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Contributing

1. fork and clone the project
2. install the dependencies above
3. run the tests with make:
> make unit functional integration doctest
4. hack at will
5. commit, push etc
6. send a pull request

## keep in mind

![your lack of tests if disturbing the force](http://farm3.static.flickr.com/2248/2282734669_a7f431e660_o.jpg)

### that lettuce is a testing software, patches and pull requests must come with automated tests, and if suitable, with proper documentation.
18 changes: 1 addition & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# lettuce
> Version 0.2.8 - kryptonite
> Version 0.2.10 - kryptonite
## On release names

Expand Down Expand Up @@ -51,22 +51,6 @@ all them are used within lettuce tests
* [django](http://djangoproject.com/)
> [sudo] pip install django
# Contributing

1. fork and clone the project
2. install the dependencies above
3. run the tests with make:
> make unit functional integration doctest
4. hack at will
5. commit, push etc
6. send a pull request

## keep in mind

![your lack of tests if disturbing the force](http://farm3.static.flickr.com/2248/2282734669_a7f431e660_o.jpg)

### that lettuce is a testing software, patches and pull requests must come with automated tests, and if suitable, with proper documentation.

# mailing list

## for users
Expand Down
18 changes: 14 additions & 4 deletions lettuce/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,20 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

version = '0.2.8'
version = '0.2.10'
release = 'kryptonite'

import os
import sys
import traceback
from imp import reload
try:
from imp import reload
except ImportError:
# python 2.5 fallback
pass

from datetime import datetime
import random

from lettuce.core import Feature, TotalResult

Expand Down Expand Up @@ -76,7 +82,7 @@ class Runner(object):
Takes a base path as parameter (string), so that it can look for
features and step definitions on there.
"""
def __init__(self, base_path, scenarios=None, verbosity=0,
def __init__(self, base_path, scenarios=None, verbosity=0, random=False,
enable_xunit=False, xunit_filename=None, tags=None):
""" lettuce.Runner will try to find a terrain.py file and
import it from within `base_path`
Expand Down Expand Up @@ -107,6 +113,8 @@ def __init__(self, base_path, scenarios=None, verbosity=0,
else:
from lettuce.plugins import colored_shell_output as output

self.random = random

if enable_xunit:
xunit_output.enable(filename=xunit_filename)

Expand All @@ -132,6 +140,8 @@ def run(self):
features_files = [self.single_feature]
else:
features_files = self.loader.find_feature_files()
if self.random:
random.shuffle(features_files)

if not features_files:
self.output.print_no_features_found(self.loader.base_dir)
Expand All @@ -142,7 +152,7 @@ def run(self):
for filename in features_files:
feature = Feature.from_file(filename)
results.append(
feature.run(self.scenarios, tags=self.tags))
feature.run(self.scenarios, tags=self.tags, random=self.random))

except exceptions.LettuceSyntaxError, e:
sys.stderr.write(e.msg)
Expand Down
9 changes: 8 additions & 1 deletion lettuce/bin.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ def main(args=sys.argv[1:]):
'(prefixing tags with "-" will exclude them and '
'prefixing with "~" will match approximate words)')

parser.add_option("-r", "--random",
dest="random",
action="store_true",
default=False,
help="Run scenarios in a more random order to avoid interference")

parser.add_option("--with-xunit",
dest="enable_xunit",
action="store_true",
Expand All @@ -60,7 +66,7 @@ def main(args=sys.argv[1:]):
help='Write JUnit XML to this file. Defaults to '
'lettucetests.xml')

options, args = parser.parse_args()
options, args = parser.parse_args(args)
if args:
base_path = os.path.abspath(args[0])

Expand All @@ -73,6 +79,7 @@ def main(args=sys.argv[1:]):
base_path,
scenarios=options.scenarios,
verbosity=options.verbosity,
random=options.random,
enable_xunit=options.enable_xunit,
xunit_filename=options.xunit_file,
tags=options.tags,
Expand Down
Loading

0 comments on commit 4539b44

Please sign in to comment.