Skip to content

Instantly share code, notes, and snippets.

@shon
Created June 19, 2014 12:27
Show Gist options
  • Save shon/90ac6af750b575cde050 to your computer and use it in GitHub Desktop.
Save shon/90ac6af750b575cde050 to your computer and use it in GitHub Desktop.
Behaving | features/environment.py
import os
from behaving import environment as benv
from splinter import Browser
default_browser = Browser()
PERSONAS = {}
def _mkdir(path):
return os.makedirs(path) if not os.path.exists(path) else None
def before_all(context):
basedir = os.path.join(os.path.dirname(__file__), 'tests')
attdir = os.path.join(basedir, 'data')
sms_path = os.path.join(basedir, 'sms')
mail_path = os.path.join(basedir, 'mail')
screenshots_dir = os.path.join(basedir, 'screenshots')
for d in (attdir, sms_path, mail_path, screenshots_dir):
_mkdir(d)
context.attachment_dir = attdir
context.sms_path = sms_path
context.mail_path = mail_path
context.screenshots_dir = screenshots_dir
#context.remote_webdriver = True
context.browser = default_browser
benv.before_all(context)
def after_all(context):
benv.after_all(context)
def before_feature(context, feature):
benv.before_feature(context, feature)
def after_feature(context, feature):
benv.after_feature(context, feature)
def before_scenario(context, scenario):
benv.before_scenario(context, scenario)
context.personas = PERSONAS
context.browser = default_browser
def after_scenario(context, scenario):
benv.after_scenario(context, scenario)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment