Files
playwright/tests/test_fixtures_name_why_the_package_is_missing.py
feder-crandClaude Opus 5.5 e7c64166ad tests: the conftest takes the engine entry table from invisible_core.seal, and a test fails if a wrapper file imports a name the core removed
The core 66.76.0 removes constants.BINARY_ENTRY_REL; tests/conftest.py imported it
(inside a try that hid the error), so every fixture that needs the package failed at
setup in the core's wrapper-on-this-core job. seal.DEFAULT_ENTRY_REL is the table it
was a copy of, and exists in both cores.

The new test reads every Python file of src, tests, scripts, ci and examples and fails
on an import or an access of BINARY_ENTRY_REL, tz_env, BROKEN_VERSIONS,
cache_dir_for_version, resolve_session_timezone, _pin, _parse_checksums, or the two
database helpers of invisible_core.download. It has its own known-bad cases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 00:37:09 +01:00

31 lines
1.1 KiB
Python

"""A fixture that needs the package says why it cannot have it.
⛔ THE KNOWN-BAD INPUT, measured 2026-10-25: with a core whose version the
wrapper's pin did not name, `invisible_playwright` was not importable, the
conftest kept `DEFAULT_ENTRY_REL = None`, and `firefox_binary` answered
TypeError: argument of type 'NoneType' is not iterable
which names neither the pin nor the import. `_require_package()` existed for
exactly this and two fixtures did not call it.
"""
from __future__ import annotations
import pytest
import conftest
pytestmark = pytest.mark.unit
@pytest.mark.parametrize("fixture", ["firefox_binary", "sample_profile"])
def test_the_fixture_names_the_import_error(monkeypatch, fixture):
monkeypatch.delenv("INVPW_BINARY_PATH", raising=False)
monkeypatch.setattr(conftest, "_IMPORT_ERROR",
ImportError("the pin names a core that is not installed"))
monkeypatch.setattr(conftest, "DEFAULT_ENTRY_REL", None)
monkeypatch.setattr(conftest, "generate_profile", None)
body = getattr(conftest, fixture).__wrapped__
with pytest.raises(pytest.UsageError, match="the pin names a core"):
body()