Skip to content

Commit e9a8b2f

Browse files
authored
Avoid ignored explicit argument 're' console message (#2545)
Fixes: #2342
1 parent 991ac4d commit e9a8b2f

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

docs/changelog/2342.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Avoid ignored explicit argument 're' console message. - by :user:`ssbarnea`.

docs/faq.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,3 +242,9 @@ that programs may issue custom exit codes with any value, so their documentation
242242
Sometimes, no exit code is given at all. An example may be found in
243243
:gh:`pytest-qt issue #170 <pytest-dev/pytest-qt/issues/170>`, where Qt was calling
244244
`abort() <https://www.unix.org/version2/sample/abort.html>`_ instead of ``exit()``.
245+
246+
Access full logs
247+
----------------
248+
249+
If you want to access the full logs you need to write ``-q`` and ``-v`` as
250+
individual tox arguments and avoid combining them into a single one.

src/tox/config/cli/parse.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
"""
44
from __future__ import annotations
55

6+
import os
7+
from contextlib import redirect_stderr
68
from pathlib import Path
79
from typing import TYPE_CHECKING, Callable, NamedTuple, Sequence, cast
810

@@ -45,7 +47,9 @@ def _get_base(args: Sequence[str]) -> tuple[int, ToxHandler, Source]:
4547
tox_parser = ToxParser.base()
4648
parsed = Parsed()
4749
try:
48-
tox_parser.parse_known_args(args, namespace=parsed)
50+
with open(os.devnull, "w") as f:
51+
with redirect_stderr(f):
52+
tox_parser.parse_known_args(args, namespace=parsed)
4953
except SystemExit:
5054
... # ignore parse errors, such as -va raises ignored explicit argument 'a'
5155
guess_verbosity = parsed.verbosity

0 commit comments

Comments
 (0)