import logging


def test_setup_file_logging_writes_to_known_path(tmp_path, monkeypatch):
    monkeypatch.setenv("LOCALAPPDATA", str(tmp_path))
    from gui_v6.logging_setup import setup_file_logging, _reset_for_tests

    try:
        log_path = setup_file_logging()
        assert log_path.parent.exists()
        logging.getLogger("test.e1").warning("ligne-temoin-42")
        for h in logging.getLogger().handlers:
            h.flush()
        assert "ligne-temoin-42" in log_path.read_text(encoding="utf-8")
    finally:
        _reset_for_tests()
