Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@ Read the [documentation][docs].
Invocation
----------

Pass the `--with-gherkin` argument to `nosetests` to run your BDD tests. You
may also pass the `--no-ignore-python` argument to run other nose discovered
tests as well.
Pass the `--with-gherkin` argument to `nosetests` to run your BDD tests.

The `aloe` command line tool is a wrapper for the `nose` runner, configured to
only run Gherkin tests. As such, the invocation is the same as `nose`, but the
following parameters are added:
The `aloe` command line tool is a deprecated wrapper for the `nose` runner,
configured to only run Gherkin tests. As such, the invocation is the same as
`nose`, but the following parameters are added:

* `-n N[,N...]` - only run the specified scenarios (by number, 1-based) in each
feature. Makes sense when only specifying one feature to run, for example
Expand Down
16 changes: 0 additions & 16 deletions aloe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from __future__ import division
from __future__ import absolute_import

import sys
import threading

from aloe.registry import (
Expand All @@ -20,18 +19,3 @@
)

world = threading.local() # pylint:disable=invalid-name


def main(argv=None): # pragma: no cover
"""
Entry point for running Aloe.
"""

if argv is None:
argv = sys.argv

from aloe.runner import Runner
Runner(argv)

if __name__ == '__main__': # pragma: no cover
main()
40 changes: 40 additions & 0 deletions aloe/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Main module.
"""

from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import

import sys
import time


def main(argv=None): # pragma: no cover
"""
Entry point for running Aloe.
"""

import aloe.plugin
aloe.plugin.USING_DEPRECATED_RUNNER = True
sys.stderr.write(
'**************************************************\n'
'* The `aloe` command is deprecated. *\n'
'* Run `nosetests --with-gherkin` instead. *\n'
'* ...sleeping for 3 seconds... *\n'
'**************************************************\n'
)
time.sleep(3)

if argv is None:
argv = sys.argv

from aloe.runner import Runner
Runner(argv)
main.USING_DEPRECATED_RUNNER = False

if __name__ == '__main__': # pragma: no cover
main()
27 changes: 18 additions & 9 deletions aloe/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
from aloe.result import AloeTestResult


USING_DEPRECATED_RUNNER = False


class GherkinPlugin(Plugin):
"""
Collect Gherkin tests.
Expand Down Expand Up @@ -75,29 +78,35 @@ def options(self, parser, env=None):

test_class_name = \
'{c.__module__}.{c.__name__}'.format(c=self.TEST_CLASS)

# default values for command line arguments
parser.set_defaults(
test_class_name=env.get('NOSE_GHERKIN_CLASS', test_class_name),
ignore_python=USING_DEPRECATED_RUNNER,
scenario_indices='',
force_color=False,
)

parser.add_option(
'--test-class', action='store',
dest='test_class_name',
default=env.get('NOSE_GHERKIN_CLASS', test_class_name),
metavar='TEST_CLASS',
help='Base class to use for the generated tests',
)
parser.add_option(
'--no-ignore-python', action='store_false',
dest='ignore_python',
default=True,
help='Run Python and Gherkin tests together',
)
if USING_DEPRECATED_RUNNER:
parser.add_option(
'--no-ignore-python', action='store_false',
dest='ignore_python',
help='Run Python and Gherkin tests together',
)
parser.add_option(
'-n', '--scenario-indices', action='store',
dest='scenario_indices',
default='',
help='Only run scenarios with these indices (comma-separated)',
)
parser.add_option(
'--color', action='store_true',
dest='force_color',
default=False,
help='Force colored output',
)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
'aloe = aloe.plugin:GherkinPlugin',
],
'console_scripts': [
'aloe = aloe:main',
'aloe = aloe.__main__:main',
],
},

Expand Down