@pytest.fixture(scope=u'function')
def remove_output_folder(request):
 def finalizer_remove_output_folder():
  if os.path.exists(u'output_folder'):
   utils.rmtree(u'output_folder')
 request.addfinalizer(finalizer_remove_output_folder)

@ pytest . fixture ( scope = u'function' ) def remove_output_folder ( request ) : def finalizer_remove_output_folder ( ) : if os . path . exists ( u'output_folder' ) : utils . rmtree ( u'output_folder' ) request . addfinalizer ( finalizer_remove_output_folder )
remove the output folder in case it exists on disk .