Skip to content

Commit 83e272f

Browse files
committed
Replace usefixtures by autouse
1 parent 6b811c0 commit 83e272f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/unit/test_client_errors.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,14 @@
1717

1818

1919
@respx.mock
20-
@pytest.fixture
20+
@pytest.fixture(autouse=True)
2121
def mocked_response(respx_mock: MockRouter) -> None:
2222
response_content = json.dumps(
2323
{'error': {'message': _EXPECTED_MESSAGE, 'type': _EXPECTED_TYPE, 'data': _EXPECTED_DATA}}
2424
)
2525
respx_mock.get(_TEST_URL).mock(return_value=httpx.Response(400, content=response_content))
2626

2727

28-
@pytest.mark.usefixtures('mocked_response')
2928
def test_client_apify_api_error_with_data() -> None:
3029
"""Test that client correctly throws ApifyApiError with error data from response."""
3130
client = HTTPClient()
@@ -38,12 +37,13 @@ def test_client_apify_api_error_with_data() -> None:
3837
assert e.value.data == _EXPECTED_DATA
3938

4039

41-
@pytest.mark.usefixtures('mocked_response')
4240
async def test_async_client_apify_api_error_with_data() -> None:
4341
"""Test that async client correctly throws ApifyApiError with error data from response."""
4442
client = HTTPClientAsync()
43+
4544
with pytest.raises(ApifyApiError) as e:
4645
await client.call(method='GET', url=_TEST_URL)
46+
4747
assert e.value.message == _EXPECTED_MESSAGE
4848
assert e.value.type == _EXPECTED_TYPE
4949
assert e.value.data == _EXPECTED_DATA

0 commit comments

Comments
 (0)