allure-framework / allure-python

Allure integrations for Python test frameworks
https://allurereport.org/
Apache License 2.0
719 stars 235 forks source link

Question - is it possible call allure generation from python code #768

Closed Krata4 closed 11 months ago

Krata4 commented 11 months ago

Hello,

can you help me please, I would like call "allure generation" command from python code. Is it possible call this function please?

Thanks

delatrie commented 11 months ago

Hi, @Krata4 !

The discussions page is a much better place for such questions. Please, open a new Questions & Support discussion next time.

Regarding your question, use the subprocess module:

import subprocess

process = subprocess.run("allure generate --clean --output ./allure-report ./allure-results", shell=True)
if not process.returncode:
    print("Can't generate the report")

You may omit shell=True on Linux/MAC.