Unit suite cannot run on Windows: 9 failures from POSIX-only test scaffolding
Labels: bug, windows, tests
Description
Windows is a supported platform (the codebase has TCP-loopback IPC, tasklist probes,
a ctypes GetProcessTimes path, and CREATE_NO_WINDOW spawn flags specifically for it),
but the unit suite cannot be run there. A clean checkout on Windows gives:
$ python -m pytest tests -q
9 failed, 159 passed in 9.40s
FAILED tests/unit/test_admin.py::test_cleanup_unattached_browser_launch_stops_posix_process_group
FAILED tests/unit/test_admin.py::test_cleanup_unattached_browser_launch_keeps_cdp_browser
FAILED tests/unit/test_admin.py::test_explicit_chrome_path_retains_matching_profile_on_linux[BH_CHROME_PATH]
FAILED tests/unit/test_admin.py::test_explicit_chrome_path_retains_matching_profile_on_linux[CHROME_PATH]
FAILED tests/unit/test_admin.py::test_explicit_chrome_path_remains_unowned_without_platform_cleanup[Darwin]
FAILED tests/unit/test_admin.py::test_explicit_chrome_path_remains_unowned_without_platform_cleanup[Windows]
FAILED tests/unit/test_admin.py::test_doctor_probe_preserves_snap_bin_env_symlink
FAILED tests/unit/test_admin.py::test_doctor_probe_preserves_snap_bin_path_symlink
FAILED tests/unit/test_skill.py::test_packaged_skill_frontmatter_is_valid_simple_yamlCauses
Three distinct ones:
os.killpgmonkeypatch (6 tests).tests/unit/test_admin.pydoesmonkeypatch.setattr(admin.os, "killpg", ...).os.killpgdoes not exist on Windows, andmonkeypatch.setattrrefuses to create a missing attribute:E AttributeError: <module 'os' (frozen)> has no attribute 'killpg'Note these tests are about POSIX behaviour — two of them are even parametrised
[Darwin]/[Windows]— so they should be exercising the Windows branch of_cleanup_unattached_browser_launch()(process.terminate()), not the POSIX one.Path.symlink_to(2 tests). The snap-probe tests build a/snap/bin/chromium→/usr/bin/snapsymlink chain intmp_path:E OSError: [WinError 1314] A required privilege is not held by the clienttest_skill.py— separate root cause, tracked in the SKILL.md symlink issue.
Suggested fix
- Use
monkeypatch.setattr(admin.os, "killpg", ..., raising=False), and add the Windows-branch assertion the[Windows]parametrisation implies. - Guard the symlink tests with
@pytest.mark.skipif(sys.platform == "win32", ...), or create the symlink inside atry/except OSError: pytest.skip(...).
Pair this with a Windows CI leg so it stays fixed.
Environment
- Windows 11, Python 3.11.9,
pip install -e .+ pytest,main@e3e8069
Source: browser-use/browser-harness