<s> from behave import * <EOL> import shutil <EOL> import os <EOL> import jrnl <EOL> try : <EOL> from io import StringIO <EOL> except ImportError : <EOL> from cStringIO import StringIO <EOL> def before_scenario ( context , scenario ) : <EOL> """<STR_LIT>""" <EOL> context . messages = StringIO ( ) <EOL> jrnl . util . STDERR = context . messages <EOL> jrnl . util . TEST = True <EOL> for folder in ( "<STR_LIT>" , "<STR_LIT>" ) : <EOL> working_dir = os . path . join ( "<STR_LIT>" , folder ) <EOL> if os . path . exists ( working_dir ) : <EOL> shutil . rmtree ( working_dir ) <EOL> for folder in ( "<STR_LIT>" , "<STR_LIT>" ) : <EOL> original = os . path . join ( "<STR_LIT>" , "<STR_LIT:data>" , folder ) <EOL> working_dir = os . path . join ( "<STR_LIT>" , folder ) <EOL> if not os . path . exists ( working_dir ) : <EOL> os . mkdir ( working_dir ) <EOL> for filename in os . listdir ( original ) : <EOL> source = os . path . join ( original , filename ) <EOL> if os . path . isdir ( source ) : <EOL> shutil . copytree ( source , os . path . join ( working_dir , filename ) ) <EOL> else : <EOL> shutil . copy2 ( source , working_dir ) <EOL> def after_scenario ( context , scenario ) : <EOL> """<STR_LIT>""" <EOL> context . messages . close ( ) <EOL> context . messages = None <EOL> for folder in ( "<STR_LIT>" , "<STR_LIT>" ) : <EOL> working_dir = os . path . join ( "<STR_LIT>" , folder ) <EOL> if os . path . exists ( working_dir ) : <EOL> shutil . rmtree ( working_dir ) </s>
