pytest-dev / pytest-dev/pytest-html

Changing path of html directory using a fixture value for parametrized test

Open
#572 16 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

next-gen
Dominant language
Python
Stars
779
Forks
260
PR merge metrics
No merged PRs in 30d

Description

Hello everyone,

I was wondering if there was a way to change the output path of the html report after the test has run by using a test fixture which contains the name and parametrized values of a test i.e. :

during the test there is a fixture that creates a directory whose name is based on the values of the current test, for example :
output_path = /path/to/test/test_name_parametrized_val1_val2.

However since the value of the config.option.htmlpath seems to be given during the pytest_configure hook and the tests have not been intialized yet (output_path is not yet created and, even if it was, it is not reachable from the pytest_configure hook) I haven't been able to figure this one out yet.

I would really appreciate any advice on how to accomplish this and I apologize if the solution is trivial as I'm quite new to pytest...

Thanks and have a good day!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the pytest_configure hook and the fixture lifecycle described in the issue. Determine whether the HTML output path can use parametrized test values after tests initialize, and clarify whether the result should be a supported feature or documented guidance for configuring the report path.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.