mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-20 09:56:05 -05:00
[Downloader] Install SHARED_LIBRARY requirements (#2384)
SHARED_LIBRARY Installable types did not have the requirements as defined in info.json automatically installed. This change updates the installation of libraries to also install their requirements. Resolves #2381
This commit is contained in:
@@ -38,6 +38,22 @@ async def test_add_repo(monkeypatch, repo_manager):
|
||||
assert squid.available_modules == []
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_lib_install_requirements(monkeypatch, library_installable, repo, tmpdir):
|
||||
monkeypatch.setattr("redbot.cogs.downloader.repo_manager.Repo._run", fake_run_noprint)
|
||||
monkeypatch.setattr(
|
||||
"redbot.cogs.downloader.repo_manager.Repo.available_libraries", (library_installable,)
|
||||
)
|
||||
|
||||
lib_path = Path(str(tmpdir)) / "cog_data_path" / "lib"
|
||||
sharedlib_path = lib_path / "cog_shared"
|
||||
sharedlib_path.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
result = await repo.install_libraries(target_dir=sharedlib_path, req_target_dir=lib_path)
|
||||
|
||||
assert result is True
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_remove_repo(monkeypatch, repo_manager):
|
||||
monkeypatch.setattr("redbot.cogs.downloader.repo_manager.Repo._run", fake_run_noprint)
|
||||
|
||||
@@ -15,6 +15,17 @@ def test_process_info_file(installable):
|
||||
assert getattr(installable, k) == v
|
||||
|
||||
|
||||
def test_process_lib_info_file(library_installable):
|
||||
for k, v in LIBRARY_INFO_JSON.items():
|
||||
if k == "type":
|
||||
assert library_installable.type == InstallableType.SHARED_LIBRARY
|
||||
elif k == "hidden":
|
||||
# libraries are always hidden, even if False
|
||||
assert library_installable.hidden is True
|
||||
else:
|
||||
assert getattr(library_installable, k) == v
|
||||
|
||||
|
||||
# noinspection PyProtectedMember
|
||||
def test_location_is_dir(installable):
|
||||
assert installable._location.exists()
|
||||
|
||||
Reference in New Issue
Block a user