diff --git a/docs/changelog/2342.bugfix.rst b/docs/changelog/2342.bugfix.rst new file mode 100644 index 000000000..953f86bc9 --- /dev/null +++ b/docs/changelog/2342.bugfix.rst @@ -0,0 +1 @@ +Avoid ignored explicit argument 're' console message. - by :user:`ssbarnea`. diff --git a/docs/faq.rst b/docs/faq.rst index 0d232f56f..1f584dc4e 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -242,3 +242,9 @@ that programs may issue custom exit codes with any value, so their documentation Sometimes, no exit code is given at all. An example may be found in :gh:`pytest-qt issue #170 `, where Qt was calling `abort() `_ instead of ``exit()``. + +Access full logs +---------------- + +If you want to access the full logs you need to write ``-q`` and ``-v`` as +individual tox arguments and avoid combining them into a single one. diff --git a/src/tox/config/cli/parse.py b/src/tox/config/cli/parse.py index e7868469c..7e1163a31 100644 --- a/src/tox/config/cli/parse.py +++ b/src/tox/config/cli/parse.py @@ -3,6 +3,8 @@ """ from __future__ import annotations +import os +from contextlib import redirect_stderr from pathlib import Path from typing import TYPE_CHECKING, Callable, NamedTuple, Sequence, cast @@ -45,7 +47,9 @@ def _get_base(args: Sequence[str]) -> tuple[int, ToxHandler, Source]: tox_parser = ToxParser.base() parsed = Parsed() try: - tox_parser.parse_known_args(args, namespace=parsed) + with open(os.devnull, "w") as f: + with redirect_stderr(f): + tox_parser.parse_known_args(args, namespace=parsed) except SystemExit: ... # ignore parse errors, such as -va raises ignored explicit argument 'a' guess_verbosity = parsed.verbosity