MCPcopy
hub / github.com/scrapy/scrapy / from_spider

Method from_spider

scrapy/contracts/__init__.py:125–135  ·  view source on GitHub ↗
(self, spider: Spider, results: TestResult)

Source from the content-addressed store, hash-verified

123 return contracts
124
125 def from_spider(self, spider: Spider, results: TestResult) -> list[Request | None]:
126 requests: list[Request | None] = []
127 for method in self.tested_methods_from_spidercls(type(spider)):
128 bound_method = getattr(spider, method)
129 try:
130 requests.append(self.from_method(bound_method, results))
131 except Exception:
132 case = _create_testcase(bound_method, "contract")
133 results.addError(case, sys.exc_info())
134
135 return requests
136
137 def from_method(
138 self, method: Callable[..., Any], results: TestResult

Callers 4

startMethod · 0.80
test_custom_contractsMethod · 0.80
startMethod · 0.80

Calls 3

from_methodMethod · 0.95
_create_testcaseFunction · 0.85

Tested by 3

test_custom_contractsMethod · 0.64
startMethod · 0.64