mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-21 10:17:59 -05:00
[Config] Asynchronous getters (#907)
* Make config get async * Asyncify alias * Asyncify bank * Asyncify cog manager * IT BOOTS * Asyncify core commands * Asyncify repo manager * Asyncify downloader * Asyncify economy * Asyncify alias TESTS * Asyncify economy TESTS * Asyncify downloader TESTS * Asyncify config TESTS * A bank thing * Asyncify Bank cog * Warning message in docs * Update docs with await syntax * Update docs with await syntax
This commit is contained in:
@@ -14,16 +14,17 @@ def default_dir(red):
|
||||
return red.main_dir
|
||||
|
||||
|
||||
def test_ensure_cogs_in_paths(cog_mgr, default_dir):
|
||||
@pytest.mark.asyncio
|
||||
async def test_ensure_cogs_in_paths(cog_mgr, default_dir):
|
||||
cogs_dir = default_dir / 'cogs'
|
||||
assert cogs_dir in cog_mgr.paths
|
||||
assert cogs_dir in await cog_mgr.paths()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_install_path_set(cog_mgr: cog_manager.CogManager, tmpdir):
|
||||
path = Path(str(tmpdir))
|
||||
await cog_mgr.set_install_path(path)
|
||||
assert cog_mgr.install_path == path
|
||||
assert await cog_mgr.install_path() == path
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@@ -38,7 +39,7 @@ async def test_install_path_set_bad(cog_mgr):
|
||||
async def test_add_path(cog_mgr, tmpdir):
|
||||
path = Path(str(tmpdir))
|
||||
await cog_mgr.add_path(path)
|
||||
assert path in cog_mgr.paths
|
||||
assert path in await cog_mgr.paths()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@@ -54,4 +55,4 @@ async def test_remove_path(cog_mgr, tmpdir):
|
||||
path = Path(str(tmpdir))
|
||||
await cog_mgr.add_path(path)
|
||||
await cog_mgr.remove_path(path)
|
||||
assert path not in cog_mgr.paths
|
||||
assert path not in await cog_mgr.paths()
|
||||
|
||||
Reference in New Issue
Block a user