Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Neet to set the report path from script #6

Open
dkjha52 opened this issue Jan 24, 2021 · 3 comments
Open

Neet to set the report path from script #6

dkjha52 opened this issue Jan 24, 2021 · 3 comments

Comments

@dkjha52
Copy link

dkjha52 commented Jan 24, 2021

I want to set the report path from script (conftest.py). Please let me know the scripts for that so i can set --report=report.html from script.

@christiansandberg christiansandberg transferred this issue from christiansandberg/pytest-reporter-html1 Jan 25, 2021
@christiansandberg
Copy link
Owner

This is not possible at the moment, but you can copy the report to another location using the pytest_reporter_finish hook.

def pytest_reporter_finish(path, context, config):
    # Copy or move path to another location

@dkjha52
Copy link
Author

dkjha52 commented Feb 6, 2021

Thanks for the response. Can you please help me to provide sample scripts..

@quanlidavid
Copy link

quanlidavid commented Mar 22, 2023

I think you can change report path in this hook. Add below in your conftest.py

def pytest_reporter_context(context, config):
    config.option.report[0] = config.option.report[0].replace('.html', str(datetime.datetime.now().strftime(
        "%Y-%m-%d-%H-%M-%S")) + '.html')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants