Renders the python script to a file to execute in the virtual environment. :param jinja_context: The jinja context variables to unpack and replace with its placeholders in the template file. :type jinja_context: dict :param filename: The name of the file to dump the rendere
(jinja_context: dict, filename: str)
| 70 | |
| 71 | |
| 72 | def write_python_script(jinja_context: dict, filename: str): |
| 73 | """ |
| 74 | Renders the python script to a file to execute in the virtual environment. |
| 75 | |
| 76 | :param jinja_context: The jinja context variables to unpack and replace with its placeholders in the |
| 77 | template file. |
| 78 | :type jinja_context: dict |
| 79 | :param filename: The name of the file to dump the rendered script to. |
| 80 | :type filename: str |
| 81 | """ |
| 82 | template_loader = jinja2.FileSystemLoader(searchpath=os.path.dirname(__file__)) |
| 83 | template_env = jinja2.Environment(loader=template_loader, undefined=jinja2.StrictUndefined) |
| 84 | template = template_env.get_template('python_virtualenv_script.jinja2') |
| 85 | template.stream(**jinja_context).dump(filename) |
no test coverage detected