pytest-dev / pytest-dev/pytest

Allow interpolating values into getini help

Open
#9,244 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

topic: config type: enhancement
Dominant language
Python
Stars
14.5k
Forks
3.4k
Avg merge
2d 9h
Merged PRs (30d)
35

Description

What's the problem this feature will solve?

The help parameter to parser.addoption() allows interpolating other parameters in the help string, e.g.

parser.addoption("--foo", help="Foo, defaults to %(default)s", default="asdf")

It would be great if parser.addini() supported the same, e.g.

parser.addini("foo", help="Foo, defaults to %(default)s", default="asdf")
Alternative Solutions

One can manually interpolate, or just duplicate it

default = "asdf"
parser.addini("foo", help=f"Foo, defaults to {default}", default=default)

parser.addini("foo", help="Foo, defaults to asdf", default="asdf")
Additional context

https://docs.python.org/3/library/argparse.html#help

Contributor guide

Open the contributing guide

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 parser.addini and the existing parser.addoption help interpolation behavior, then find the related parser tests. Confirm that a %(default)s placeholder in an addini help string uses the supplied default value, while preserving the documented addoption behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.