Skip to content

test_webbrowser failure on MacOS if BROWSER set to "open" #131254

@smontanaro

Description

@smontanaro

Bug report

Bug description:

I just noticed a new-to-me failure on main for the test_webbrowser unit test. Here's the rundown:

% ./python.exe -E  -m test test_webbrowser
Using random seed: 3730311481
Raised RLIMIT_NOFILE: 256 -> 1024
0:00:00 load avg: 4.38 Run 1 test sequentially in a single process
0:00:00 load avg: 4.38 [1/1] test_webbrowser
test test_webbrowser failed -- Traceback (most recent call last):
  File "/Users/skip/src/python/cpython/Lib/test/test_webbrowser.py", line 334, in test_default
    assert isinstance(browser, webbrowser.MacOSXOSAScript)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

0:00:00 load avg: 4.38 [1/1/1] test_webbrowser failed (1 failure)

== Tests result: FAILURE ==

1 test failed:
    test_webbrowser

Total duration: 48 ms
Total tests: run=48 failures=1 skipped=4
Total test files: run=1/1 failed=1
Result: FAILURE
% env | grep BROWSER
BROWSER=open
% unset BROWSER     
% ./python.exe -E  -m test test_webbrowser
Using random seed: 2541583609
Raised RLIMIT_NOFILE: 256 -> 1024
0:00:00 load avg: 3.19 Run 1 test sequentially in a single process
0:00:00 load avg: 3.19 [1/1] test_webbrowser
0:00:00 load avg: 3.19 [1/1] test_webbrowser passed

== Tests result: SUCCESS ==

1 test OK.

Total duration: 50 ms
Total tests: run=48 skipped=4
Total test files: run=1/1
Result: SUCCESS

In short, if the BROWSER environment variable is set to open, the test fails. (This didn't used to be the case as far as I can recall. The entire test suite passed a couple days ago with the expected skips, no failures.) If I unset BROWSER, the test succeeds.

I suspect this commit is the culprit: 96492785b202a92af1b71f8c011ea839ca3ebb07

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

Linked PRs

Feature was introduced in #130535.

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.14bugs and security fixesOS-mactestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions