test: Restructure test files
Extract the individual parsing tests (cli, env, rc) and add additional configuration test file (TConf and config builder). To extract the fixtures they have to go into an additional 'conftest.py' file for pytest to recognize and automatically import them, see: https://docs.pytest.org/en/stable/reference/fixtures.html#conftest-py-sharing-fixtures-across-multiple-files and: https://docs.pytest.org/en/stable/how-to/fixtures.html#using-fixtures-from-other-projects
This commit is contained in:
parent
ff0e6cccfb
commit
13c34b08e2
6 changed files with 224 additions and 114 deletions
14
topen.py
14
topen.py
|
|
@ -132,7 +132,7 @@ class Opt:
|
|||
metavar: str | None = None
|
||||
cast: type | Callable = str
|
||||
help_text: str = ""
|
||||
flag: bool = False
|
||||
is_flag: bool = False
|
||||
|
||||
|
||||
def _real_path(p: Path | str) -> Path:
|
||||
|
|
@ -224,7 +224,8 @@ OPTIONS: dict[str, Opt] = {
|
|||
"notes.quiet",
|
||||
default=False,
|
||||
cast=_strtobool,
|
||||
help_text="Silence any verbose displayed information",
|
||||
help_text="Silence any verbosely displayed information",
|
||||
is_flag=True,
|
||||
),
|
||||
}
|
||||
|
||||
|
|
@ -321,6 +322,15 @@ you view the task.
|
|||
for key, opt in OPTIONS.items():
|
||||
if opt.cli is None:
|
||||
continue
|
||||
if opt.is_flag:
|
||||
parser.add_argument(
|
||||
*opt.cli,
|
||||
dest=key,
|
||||
help=opt.help_text,
|
||||
default=None,
|
||||
action="store_true",
|
||||
)
|
||||
continue
|
||||
parser.add_argument(
|
||||
*opt.cli,
|
||||
dest=key,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue