Skip to content

Commit

Permalink
tests: remove extra if
Browse files Browse the repository at this point in the history
  • Loading branch information
yolile committed May 31, 2022
1 parent ae7a75c commit 453ecce
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@ def test_decorated(self, response, **kwargs):
mock_response = Mock()
mock_response.status = 429
mock_response.headers = {'Retry-After': 5}
meta = {}
if attempts:
meta['retries'] = attempts
mock_response.request = scrapy.Request('http://test.com', meta=meta)
mock_response.request = scrapy.Request('http://test.com', meta={'retries': attempts})

This comment has been minimized.

Copy link
@jpmckinney

jpmckinney May 31, 2022

Member

This was intentional. When attempts = 0 there should be no pre-existing meta entry in the request. This allows us to test the code that sets the default to 0.


actual = next(test_decorated(spider, mock_response))

Expand Down

0 comments on commit 453ecce

Please sign in to comment.