Skip to content

Commit 313ab4b

Browse files
committed
Use @pytest.mark.asyncio annotation
1 parent b71d223 commit 313ab4b

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

requirements-test.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ pytest==8.4.0
22
pytest-pep8==1.0.6
33
pytest-cov==6.1.1
44
pytest-aiohttp==1.1.0
5+
pytest-asyncio==1.0.0
56
responses==0.25.7
67
pytest_httpserver >= 1.1.2

tests/async_api/test_get_message_content.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# License for the specific language governing permissions and limitations
1313
# under the License.
1414

15+
import pytest
16+
1517
from aiohttp import web
1618

1719
from linebot import (
@@ -20,6 +22,7 @@
2022
from linebot.aiohttp_async_http_client import AiohttpAsyncHttpClient
2123

2224

25+
@pytest.mark.asyncio
2326
async def test_get(aiohttp_client):
2427
msg = ''.join('Hello, world' for i in range(1000))
2528

tests/async_api/test_get_profile.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# License for the specific language governing permissions and limitations
1313
# under the License.
1414

15+
import pytest
16+
1517
from aiohttp import web
1618

1719
from linebot import (
@@ -20,6 +22,7 @@
2022
from linebot.aiohttp_async_http_client import AiohttpAsyncHttpClient
2123

2224

25+
@pytest.mark.asyncio
2326
async def test_async_profile(aiohttp_client):
2427
expect = {
2528
'displayName': 'test',

tests/test_aiohttp_async_http_client.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212
# License for the specific language governing permissions and limitations
1313
# under the License.
1414

15+
import pytest
1516
from aiohttp import web
1617

1718
from linebot.aiohttp_async_http_client import AiohttpAsyncHttpClient
1819

1920

21+
@pytest.mark.asyncio
2022
async def test_get(aiohttp_client):
2123
async def hello(request):
2224
return web.Response(text='Hello, world')
@@ -31,6 +33,7 @@ async def hello(request):
3133
assert 'Hello, world' in text
3234

3335

36+
@pytest.mark.asyncio
3437
async def test_get_json(aiohttp_client):
3538
async def hello(request):
3639
return web.json_response({'test': 'Hello, world'})
@@ -44,6 +47,7 @@ async def hello(request):
4447
assert 'Hello, world' == json['test']
4548

4649

50+
@pytest.mark.asyncio
4751
async def test_get_iter(aiohttp_client):
4852
async def hello(request):
4953
return web.Response(text='Hello, world')
@@ -61,6 +65,7 @@ async def hello(request):
6165
assert 'Hello, world' in buffer
6266

6367

68+
@pytest.mark.asyncio
6469
async def test_post(aiohttp_client):
6570
async def hello(request):
6671
return web.Response(text='Hello, world')
@@ -75,6 +80,7 @@ async def hello(request):
7580
assert 'Hello, world' in text
7681

7782

83+
@pytest.mark.asyncio
7884
async def test_delete(aiohttp_client):
7985
async def hello(request):
8086
return web.Response(text='Hello, world')
@@ -89,6 +95,7 @@ async def hello(request):
8995
assert 'Hello, world' in text
9096

9197

98+
@pytest.mark.asyncio
9299
async def test_put(aiohttp_client):
93100
async def hello(request):
94101
return web.Response(text='Hello, world')

0 commit comments

Comments
 (0)