Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added root_dir to set where the runner looks for steps to import #528

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
21 changes: 7 additions & 14 deletions lettuce/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import os
import sys
import traceback
import warnings
try:
from imp import reload
except ImportError:
Expand All @@ -41,7 +40,7 @@
from lettuce.registry import call_hook
from lettuce.registry import STEP_REGISTRY
from lettuce.registry import CALLBACK_REGISTRY
from lettuce.exceptions import StepLoadingError
from lettuce.exceptions import StepLoadingError, LettuceRunnerError
from lettuce.plugins import (
xunit_output,
subunit_output,
Expand Down Expand Up @@ -81,7 +80,7 @@

sys.stderr.write(string)
sys.stderr.write(exceptions.traceback.format_exc(e))
raise SystemExit(1)
raise LettuceRunnerError(string)


class Runner(object):
Expand Down Expand Up @@ -125,17 +124,11 @@ def __init__(self, base_path, scenarios=None,
from lettuce.plugins import dots as output
elif verbosity is 2:
from lettuce.plugins import scenario_names as output
else:
if verbosity is 4:
elif verbosity is 3:
if no_color:
from lettuce.plugins import shell_output as output
else:
from lettuce.plugins import colored_shell_output as output
msg = ('Deprecated in lettuce 2.2.21. Use verbosity 3 without '
'--no-color flag instead of verbosity 4')
warnings.warn(msg, DeprecationWarning)
elif verbosity is 3:
if no_color:
from lettuce.plugins import shell_output as output
else:
from lettuce.plugins import colored_shell_output as output

self.random = random

Expand Down Expand Up @@ -215,6 +208,6 @@ def run(self):
call_hook('after', 'all', total)

if failed:
raise SystemExit(2)
raise LettuceRunnerError("Test failed.")

return total
8 changes: 4 additions & 4 deletions lettuce/django/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def _filter_bultins(module):
def _filter_configured_apps(module):
"returns only those apps that are in django.conf.settings.LETTUCE_APPS"
app_found = True
if hasattr(settings, 'LETTUCE_APPS') and isinstance(settings.LETTUCE_APPS, tuple):
if hasattr(settings, 'LETTUCE_APPS') and isinstance(settings.LETTUCE_APPS, (list, tuple)):
app_found = False
for appname in settings.LETTUCE_APPS:
if module.__name__.startswith(appname):
Expand All @@ -44,7 +44,7 @@ def _filter_configured_apps(module):
def _filter_configured_avoids(module):
"returns apps that are not within django.conf.settings.LETTUCE_AVOID_APPS"
run_app = False
if hasattr(settings, 'LETTUCE_AVOID_APPS') and isinstance(settings.LETTUCE_AVOID_APPS, tuple):
if hasattr(settings, 'LETTUCE_AVOID_APPS') and isinstance(settings.LETTUCE_AVOID_APPS, (list, tuple)):
for appname in settings.LETTUCE_AVOID_APPS:
if module.__name__.startswith(appname):
run_app = True
Expand Down Expand Up @@ -73,7 +73,7 @@ def harvest_lettuces(only_the_apps=None, avoid_apps=None, path="features"):

apps = get_apps()

if isinstance(only_the_apps, tuple) and any(only_the_apps):
if isinstance(only_the_apps, (list, tuple)) and any(only_the_apps):

def _filter_only_specified(module):
return module.__name__ in only_the_apps
Expand All @@ -83,7 +83,7 @@ def _filter_only_specified(module):
apps = filter(_filter_configured_apps, apps)
apps = filter(_filter_configured_avoids, apps)

if isinstance(avoid_apps, tuple) and any(avoid_apps):
if isinstance(avoid_apps, (list, tuple)) and any(avoid_apps):

def _filter_avoid(module):
return module.__name__ not in avoid_apps
Expand Down
Loading