Skip to content

Commit 5dd1bec

Browse files
committed
fix failing tests
1 parent 97ea1e4 commit 5dd1bec

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ You can see the full list of parameters in the `Zyte API Specification
7979

8080
On the other hand, you could also control it on a per request basis by setting the
8181
``zyte_api`` key in `Request.meta <https://docs.scrapy.org/en/latest/topics/request-response.html#scrapy.http.Request.meta>`_.
82-
When doing so, it will override any parameters that was set via the setting
83-
named ``ZYTE_API_DEFAULT_PARAMS``.
82+
When doing so, it will override any parameters that was set in the
83+
``ZYTE_API_DEFAULT_PARAMS`` setting.
8484

8585
.. code-block:: python
8686

tests/test_api_requests.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import sys
23
from asyncio import iscoroutine
34
from typing import Any, Dict
45
from unittest import mock
@@ -101,6 +102,9 @@ async def test_http_response_headers_request(self, meta: Dict[str, Dict[str, Any
101102
assert resp.body == b"<html></html>"
102103
assert resp.headers == {b"Test_Header": [b"test_value"]}
103104

105+
@pytest.mark.skipif(
106+
sys.version_info < (3, 8), reason="Python3.7 has poor support for AsyncMocks"
107+
)
104108
@pytest.mark.parametrize(
105109
"meta,custom_settings,expected",
106110
[
@@ -136,9 +140,10 @@ async def test_empty_zyte_api_request_meta(
136140
# This would always error out since the mocked client doesn't
137141
# return the expected API response.
138142
await self.produce_request_response(meta, custom_settings=custom_settings)
139-
except:
143+
except Exception:
140144
pass
141145

146+
# What we're interested in is the Request call in the API
142147
request_call = [c for c in mock_client.mock_calls if "request_raw(" in str(c)]
143148
if not request_call:
144149
pytest.fail("The client's request_raw() method was not called.")

0 commit comments

Comments
 (0)