[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:
Seputaes
2019-02-26 21:07:05 -08:00
committed by Toby Harradine
parent 5a15939f08
commit 16614168a7
5 changed files with 64 additions and 4 deletions

View File

@@ -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)

View File

@@ -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()