Skip to content

Commit 72133dd

Browse files
committed
Fix tests with aiohttp >= 3.10.0
aiohttp 3.10.0 removed the ability to create `aiohttp.ClientSession` instances without a running event loop (see aio-libs/aiohttp#8583), but a few of blinkpy's tests relied on that.
1 parent 0a3ba30 commit 72133dd

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

tests/test_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
class TestAPI(IsolatedAsyncioTestCase):
1818
"""Test the API class in blinkpy."""
1919

20-
def setUp(self):
20+
async def asyncSetUp(self):
2121
"""Set up Login Handler."""
2222
self.blink = Blink(session=mock.AsyncMock())
2323
self.auth = Auth()

tests/test_auth.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
class TestAuth(IsolatedAsyncioTestCase):
2020
"""Test the Auth class in blinkpy."""
2121

22-
def setUp(self):
22+
async def asyncSetUp(self):
2323
"""Set up Login Handler."""
2424
self.auth = Auth()
2525

@@ -29,7 +29,7 @@ def tearDown(self):
2929

3030
@mock.patch("blinkpy.helpers.util.gen_uid")
3131
@mock.patch("blinkpy.auth.util.getpass")
32-
def test_empty_init(self, getpwd, genuid):
32+
async def test_empty_init(self, getpwd, genuid):
3333
"""Test initialization with no params."""
3434
auth = Auth()
3535
self.assertDictEqual(auth.data, {})
@@ -47,7 +47,7 @@ def test_empty_init(self, getpwd, genuid):
4747

4848
@mock.patch("blinkpy.helpers.util.gen_uid")
4949
@mock.patch("blinkpy.auth.util.getpass")
50-
def test_barebones_init(self, getpwd, genuid):
50+
async def test_barebones_init(self, getpwd, genuid):
5151
"""Test basebones initialization."""
5252
login_data = {"username": "foo", "password": "bar"}
5353
auth = Auth(login_data)
@@ -64,7 +64,7 @@ def test_barebones_init(self, getpwd, genuid):
6464
}
6565
self.assertDictEqual(auth.data, expected_data)
6666

67-
def test_full_init(self):
67+
async def test_full_init(self):
6868
"""Test full initialization."""
6969
login_data = {
7070
"username": "foo",

tests/test_blinkpy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def tearDown(self):
2828
"""Cleanup blink test object."""
2929
self.blink = None
3030

31-
def test_initialization(self):
31+
async def test_initialization(self):
3232
"""Verify we can initialize blink."""
3333
blink = Blink()
3434
self.assertEqual(blink.version, __version__)

0 commit comments

Comments
 (0)