Skip to content

Commit

Permalink
fix: use AsyncDispatcher to call async tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hlouzada committed Jan 18, 2025
1 parent 167808a commit d4e60e6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions spyder/plugins/remoteclient/tests/test_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
# Third party imports
import pytest


from spyder.api.asyncdispatcher import AsyncDispatcher
from spyder.plugins.remoteclient.plugin import RemoteClient


class TestRemoteFilesAPI:
remote_temp_dir = "/tmp/spyder-remote-tests"

@pytest.mark.asyncio
@AsyncDispatcher.dispatch(early_return=False)
async def test_create_dir(
self,
remote_client: RemoteClient,
Expand All @@ -30,7 +30,7 @@ async def test_create_dir(
async with file_api_class() as file_api:
assert await file_api.mkdir(self.remote_temp_dir) == {"success": True}

@pytest.mark.asyncio
@AsyncDispatcher.dispatch(early_return=False)
async def test_list_dir(
self,
remote_client: RemoteClient,
Expand All @@ -43,7 +43,7 @@ async def test_list_dir(
async with file_api_class() as file_api:
assert await file_api.ls(self.remote_temp_dir) == []

@pytest.mark.asyncio
@AsyncDispatcher.dispatch(early_return=False)
async def test_write_file(
self,
remote_client: RemoteClient,
Expand All @@ -60,7 +60,7 @@ async def test_write_file(
await f.seek(0)
assert await f.read() == "Hello, world!"

@pytest.mark.asyncio
@AsyncDispatcher.dispatch(early_return=False)
async def test_list_directories(
self,
remote_client: RemoteClient,
Expand All @@ -85,7 +85,7 @@ async def test_list_directories(
assert ls_content[0]["ino"] > 0
assert ls_content[0]["nlink"] == 1

@pytest.mark.asyncio
@AsyncDispatcher.dispatch(early_return=False)
async def test_copy_file(
self,
remote_client: RemoteClient,
Expand All @@ -108,7 +108,7 @@ async def test_copy_file(
assert ls_content[1]["name"] == self.remote_temp_dir + "/test2.txt"
assert ls_content[0]["size"] == ls_content[1]["size"]

@pytest.mark.asyncio
@AsyncDispatcher.dispatch(early_return=False)
async def test_rm_file(
self,
remote_client: RemoteClient,
Expand All @@ -122,7 +122,7 @@ async def test_rm_file(
assert await file_api.unlink(self.remote_temp_dir + "/test.txt") == {"success": True}
assert await file_api.unlink(self.remote_temp_dir + "/test2.txt") == {"success": True}

@pytest.mark.asyncio
@AsyncDispatcher.dispatch(early_return=False)
async def test_rm_dir(
self,
remote_client: RemoteClient,
Expand Down

0 comments on commit d4e60e6

Please sign in to comment.