pytest-dev / pytest-dev/pytest-html

Add expanding the environment variables in csspath

Open
#659 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Custom CSS (Cascasding Style Sheets) can be passed on the command line using the --css option
In the current realization pytest-html checks existing of the css file with the next code

for csspath in config.getoption("css"):
    if not Path(csspath).exists():
        missing_css_files.append(csspath)

Сould you add the ability to use environment variables in the css file path? This has already been implemented for html path in HTMLReport class by os.path.expandvars

It would look like:

for csspath in config.getoption("css"):
    absolute_css_path = Path(os.path.expandvars(csspath)).expanduser().absolute()
    if not absolute_css_path.exists():
        missing_css_files.append(absolute_css_path)

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 by locating the css option handling and the existing os.path.expandvars usage in the HTMLReport class. Update the CSS path existence check consistently with that behavior, then verify that an environment-variable CSS path is accepted and missing expanded paths are reported correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, python
Domain
cli, testing-qa
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.