I am using pytest-html-reporter 0.2.9 plugin to generate execution reports. when i pass the command line argument "--html-report=./report/report.html" directly i am able to get the report in the given location.
I want to store the report in a seperate location with execution date(YYYYMMDD) as folder name and inside report_HHMM.html as the report name
reports_dir = Path('reports', time_var.strftime('%Y%m%d'))
reports_dir.mkdir(parents=True, exist_ok=True)
# line to be add for addopts
args = f"--html-report=./{reports_dir}/report_{time_var.strftime('%H%M')}.html"
config.addinivalue_line("addopts", args)
print("inside config function",config.getini("addopts"))
this is my pytest.ini file
[pytest]
pythonfiles = test
pythonfunctions = test
python_classes = *Tests
addopts =
using config.getini("addopts") i am able to see the report path getting added to the addopts,but there are no reports getting added to the created directory
I am using pytest-html-reporter 0.2.9 plugin to generate execution reports. when i pass the command line argument "--html-report=./report/report.html" directly i am able to get the report in the given location.
I want to store the report in a seperate location with execution date(YYYYMMDD) as folder name and inside report_HHMM.html as the report name
This is the logic i am currently using
@pytest.hookimpl(tryfirst=True) def pytest_configure(config): time_var = datetime.datetime.now()
create report target dir
this is my pytest.ini file [pytest] pythonfiles = test pythonfunctions = test python_classes = *Tests addopts =
using config.getini("addopts") i am able to see the report path getting added to the addopts,but there are no reports getting added to the created directory