Add error handling in contracts

This commit is contained in:
Stas Glubokiy 2018-08-11 16:08:26 +03:00
parent c8f3d07e86
commit fb7d4cbce3
1 changed files with 5 additions and 1 deletions

View File

@ -41,7 +41,11 @@ class ContractsManager(object):
requests = []
for method in self.tested_methods_from_spidercls(type(spider)):
bound_method = spider.__getattribute__(method)
requests.append(self.from_method(bound_method, results))
try:
requests.append(self.from_method(bound_method, results))
except:
case = _create_testcase(bound_method, 'contract')
results.addError(case, sys.exc_info())
return requests