tests/test_bootstrapper.py::test_cache_lookup_resolver_exception_logs_info currently assumes that INFO logs are being captured globally by pytest.
The test calls _download_wheel_from_cache() and then asserts:
assert "did not find wheel for" in caplog.text
But the code under test logs that message at INFO level:
except ResolverException:
logger.info(
f"did not find wheel for {resolved_version} in {self.cache_wheel_server_url}"
)
The test does not call caplog.set_level(...) or caplog.at_level(...), so it only passes when the test runner is configured with a sufficiently low global log level.
Upstream CI currently masks this because the Hatch test script runs pytest with:
Downstream runners that invoke pytest with default logging behavior can fail on this test. For example, nixpkgs' pytestCheckHook reproduces:
FAILED tests/test_bootstrapper.py::test_cache_lookup_resolver_exception_logs_info
E AssertionError: assert 'did not find wheel for' in ''
I think the test should request the log level it needs explicitly rather than depending on a runner-wide pytest flag, e.g. with something like:
with caplog.at_level(logging.INFO, logger="fromager.bootstrapper"):
...
That would make the test self-contained and avoid CI-specific behavior differences.
tests/test_bootstrapper.py::test_cache_lookup_resolver_exception_logs_infocurrently assumes thatINFOlogs are being captured globally by pytest.The test calls
_download_wheel_from_cache()and then asserts:But the code under test logs that message at
INFOlevel:The test does not call
caplog.set_level(...)orcaplog.at_level(...), so it only passes when the test runner is configured with a sufficiently low global log level.Upstream CI currently masks this because the Hatch test script runs pytest with:
Downstream runners that invoke pytest with default logging behavior can fail on this test. For example, nixpkgs'
pytestCheckHookreproduces:I think the test should request the log level it needs explicitly rather than depending on a runner-wide pytest flag, e.g. with something like:
That would make the test self-contained and avoid CI-specific behavior differences.