def before_scenario(context, scenario):
    """Prepare a fresh environment for each scenario."""

    # Prepare a new temporary directory.
    context.directory = testfixtures.TempDirectory(create=True)
    context.old_cwd = os.getcwd()
    context.new_cwd = context.directory.path

    # Move into our new working directory.
    os.chdir(context.new_cwd)
def before_scenario ( context , scenario ) : context . directory = testfixtures . TempDirectory ( create = True ) context . old_cwd = os . getcwd ( ) context . new_cwd = context . directory . path os . chdir ( context . new_cwd )
Prepare a fresh environment for each scenario.