Closed wRAR closed 1 year ago
As this is not the first time scrapy shell is broken with scrapy-poet, it makes sense to make some test for it, probably similar to https://github.com/scrapy/scrapy/blob/master/tests/test_command_shell.py but simplified to one or two test cases.
Currently using
scrapy shell
to fetch a URL causes the following exception:This hides the real traceback which points to https://github.com/scrapinghub/scrapy-poet/blob/ee1357fe84465840c7d6ec1b6a0add8e622611a7/scrapy_poet/injection.py#L317. It calls
issubclass(first_parameter.annotation, DummyResponse)
wherefirst_parameter
is the callback first argument, butscrapy shell
usesDeferred.callback
as the request callback: https://github.com/scrapy/scrapy/blob/98571eb946e24edfe5b520c0478e72b695d09a9d/scrapy/shell.py#L207 and its first argument is of typeUnion[_DeferredResultT, Failure]
. There are probably multiple way to fix this.