Skip to content

Commit

Permalink
remove asynctest as a dependency since asyncio.coroutine is deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
SharpBit committed Oct 7, 2024
1 parent 5c2d2bf commit 3a7ba8f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 0 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
asynctest
flake8
pluggy>=0.12.0,<1.0.0
pytest
pytest-asyncio~=0.21.0
python-dotenv
sphinx
tox-travis
19 changes: 12 additions & 7 deletions tests/test_async.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
import os
import unittest

import asynctest
import aiohttp
import brawlstats
import pytest

from dotenv import load_dotenv

pytestmark = pytest.mark.asyncio
load_dotenv()


class TestAsyncClient(asynctest.TestCase):
class TestAsyncClient(unittest.IsolatedAsyncioTestCase):

PLAYER_TAG = '#V2LQY9UY'
CLUB_TAG = '#UL0GCC8'

async def setUp(self):
async def asyncSetUp(self):
session = aiohttp.ClientSession(trust_env=True)
self.client = brawlstats.Client(
os.getenv('token'),
token=os.getenv('token'),
session=session,
base_url=os.getenv('base_url'),
is_async=True
)

async def tearDown(self):
async def asyncTearDown(self):
await self.client.close()

async def test_get_player(self):
Expand Down Expand Up @@ -72,7 +76,8 @@ async def test_get_club_members(self):
self.assertIsInstance(club_members, brawlstats.Members)
self.assertIn(self.PLAYER_TAG, [x.tag for x in club_members])

await self.assertAsyncRaises(brawlstats.NotFoundError, self.client.get_club_members('8GGGGGGG'))
with self.assertRaises(brawlstats.NotFoundError):
await self.client.get_club_members('8GGGGGGG')

async def test_get_rankings(self):
player_ranking = await self.client.get_rankings(ranking='players')
Expand Down Expand Up @@ -115,4 +120,4 @@ async def test_get_event_rotation(self):


if __name__ == '__main__':
asynctest.main()
unittest.main()
2 changes: 1 addition & 1 deletion tests/test_blocking.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class TestBlockingClient(unittest.TestCase):

def setUp(self):
self.client = brawlstats.Client(
os.getenv('token'),
token=os.getenv('token'),
base_url=os.getenv('base_url')
)

Expand Down

0 comments on commit 3a7ba8f

Please sign in to comment.