Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions tests/test_config.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import os
import pathlib
import re
import sys

import aw_core.dirs
import pytest
import tomlkit

from aw_watcher_window import config as config_module

# The Research Edition release build (release.yml) patches config.py with
# scripts/patch_research_edition_config.py before running `make test`, which
# flips research_enabled's default to true. The guards below assert the
# pristine (non-research) defaults and must not fire on that build.
RESEARCH_BUILD = os.environ.get("AW_RESEARCH_EDITION") == "true"


def _patch_config_dir(monkeypatch, tmp_path):
"""Point aw_core's config dir at tmp_path on all platforms.
Expand Down Expand Up @@ -65,6 +73,10 @@ def test_research_options_are_read_when_user_sets_them(tmp_path, monkeypatch):
assert args.research_app_category_map == {"Microsoft Outlook": "Communication"}


@pytest.mark.skipif(
RESEARCH_BUILD,
reason="research edition build patches this default on purpose (release.yml)",
)
def test_research_edition_sed_target_is_intact():
"""The Research Edition release build patches this file with sed.

Expand Down Expand Up @@ -108,6 +120,10 @@ def test_research_edition_sed_target_is_intact():
assert tomlkit.parse(patched_defaults)["research_enabled"] is True


@pytest.mark.skipif(
RESEARCH_BUILD,
reason="research edition build patches this default on purpose (release.yml)",
)
def test_parse_args_defaults_research_off_without_config(tmp_path, monkeypatch):
"""No research keys anywhere => disabled, with empty maps."""
_patch_config_dir(monkeypatch, tmp_path)
Expand Down
Loading