Skip to content

Commit ec1c83e

Browse files
fix(testing): Prevent logging setup when --help is passed (#2923)
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
1 parent 0c84728 commit ec1c83e

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

docs/changelog/u.bugfix.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Prevent logging setup when --help is passed, fixing a flaky test.
2+
Contributed by :user:`esafak`.

src/virtualenv/run/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ def _do_report_setup(parser, args, setup_logging):
154154
verbosity = verbosity_group.add_mutually_exclusive_group()
155155
verbosity.add_argument("-v", "--verbose", action="count", dest="verbose", help="increase verbosity", default=2)
156156
verbosity.add_argument("-q", "--quiet", action="count", dest="quiet", help="decrease verbosity", default=0)
157+
# do not configure logging if only help is requested, as no logging is required for this
158+
if args and any(i in args for i in ("-h", "--help")):
159+
return
157160
option, _ = parser.parse_known_args(args)
158161
if setup_logging:
159162
setup_report(option.verbosity)

tests/integration/test_zipapp.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ def test_zipapp_in_symlink(capsys, call_zipapp_symlink):
104104
assert not err
105105

106106

107-
@pytest.mark.flaky(max_runs=2, min_passes=1)
108107
def test_zipapp_help(call_zipapp, capsys):
109108
call_zipapp("-h")
110109
_out, err = capsys.readouterr()

0 commit comments

Comments
 (0)