(testcase_file_path)
return locustfile_path
generate locustfile from template.
generate locustfile from template.
generate locustfile from template .
def gen_locustfile(testcase_file_path):
    """ generate locustfile from template.
    """
    locustfile_path = 'locustfile.py'
    template_path = os.path.join(
        os.path.dirname(os.path.realpath(__file__)),
        "templates",
        "locustfile_template"
    )

    with io.open(template_path, encoding='utf-8') as template:
        with io.open(locustfile_path, 'w', encoding='utf-8') as locustfile:
            template_content = template.read()
            template_content = template_content.replace("$TESTCASE_FILE", testcase_file_path)
            locustfile.write(template_content)

    return locustfile_path
def gen_locustfile ( testcase_file_path ) : locustfile_path = 'locustfile.py' template_path = os . path . join ( os . path . dirname ( os . path . realpath ( __file__ ) ) , "templates" , "locustfile_template" ) with io . open ( template_path , encoding = 'utf-8' ) as template : with io . open ( locustfile_path , 'w' , encoding = 'utf-8' ) as locustfile : template_content = template . read ( ) template_content = template_content . replace ( "$TESTCASE_FILE" , testcase_file_path ) locustfile . write ( template_content ) return locustfile_path