Downloader's doge_cogs clone was made when watch was added and still had the old doge_alignment info.json, which pip-installed the whole repo. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GUebqhE8dK19vyn4Ct5g1L
79 lines
3.1 KiB
Python
79 lines
3.1 KiB
Python
"""Red's internals that dogesetup calls still exist with the same shape.
|
|
|
|
These are private methods, so a Red upgrade may change them. If this fails
|
|
after bumping red-discordbot, update cogs/dogesetup before deploying.
|
|
"""
|
|
|
|
import inspect
|
|
import sys
|
|
|
|
import pytest
|
|
import redbot.core.bot # noqa: F401 (inspected below)
|
|
from redbot.cogs.downloader.downloader import Downloader
|
|
from redbot.cogs.downloader.repo_manager import Repo, RepoManager
|
|
from redbot.core.core_commands import CoreLogic
|
|
from redbot.core.tree import RedTree
|
|
|
|
EXPECTED: list[tuple[type, str, list[str]]] = [
|
|
(Downloader, "installed_cogs", ["self"]),
|
|
(
|
|
Downloader,
|
|
"_filter_incorrect_cogs_by_names",
|
|
["self", "repo", "cog_names"],
|
|
),
|
|
(Downloader, "_install_requirements", ["self", "cogs"]),
|
|
(Downloader, "_install_cogs", ["self", "cogs"]),
|
|
(Downloader, "_save_to_installed", ["self", "modules"]),
|
|
(
|
|
Downloader,
|
|
"_get_cogs_to_check",
|
|
["self", "repos", "cogs", "update_repos"],
|
|
),
|
|
(Downloader, "_available_updates", ["self", "cogs"]),
|
|
(Downloader, "_filter_incorrect_cogs", ["self", "cogs"]),
|
|
(Downloader, "_reinstall_libraries", ["self", "libraries"]),
|
|
(RepoManager, "add_repo", ["self", "url", "name", "branch"]),
|
|
(RepoManager, "get_repo", ["self", "name"]),
|
|
(Repo, "update", ["self"]),
|
|
(CoreLogic, "_load", ["self", "pkg_names"]),
|
|
(CoreLogic, "_reload", ["self", "pkg_names"]),
|
|
(redbot.core.bot.Red, "list_enabled_app_commands", ["self"]),
|
|
(
|
|
redbot.core.bot.Red,
|
|
"enable_app_command",
|
|
["self", "command_name", "command_type"],
|
|
),
|
|
(RedTree, "red_check_enabled", ["self"]),
|
|
]
|
|
|
|
|
|
@pytest.mark.parametrize(("cls", "name", "params"), EXPECTED)
|
|
def test_internal_method_exists(
|
|
cls: type, name: str, params: list[str]
|
|
) -> None:
|
|
"""``cls.name`` exists and takes ``params``."""
|
|
method = getattr(cls, name)
|
|
assert list(inspect.signature(method).parameters) == params
|
|
|
|
|
|
def test_audio_config_identifier() -> None:
|
|
"""Audio's settings are written under Audio's own identifier."""
|
|
import redbot.cogs.audio.core as audio_core # noqa: PLC0415
|
|
from dogesetup.dogesetup import AUDIO_IDENTIFIER
|
|
|
|
source = inspect.getsource(audio_core).replace(" ", "")
|
|
assert f"Config.get_conf(self,{AUDIO_IDENTIFIER}," in source
|
|
|
|
|
|
def test_startup_storage_calls_exist() -> None:
|
|
"""start.record_python_version uses these, as Red's own startup does."""
|
|
from redbot.core import Config, _drivers, data_manager # noqa: PLC0415
|
|
|
|
assert callable(data_manager.load_basic_configuration)
|
|
assert callable(data_manager.storage_details)
|
|
assert callable(_drivers.get_driver_class)
|
|
assert callable(Config.get_core_conf)
|
|
source = inspect.getsource(sys.modules["redbot.core.bot"])
|
|
assert "last_system_info__python_version" in source
|
|
assert 'if ver_info != last_system_info["python_version"]:' in source
|