I'm following Spidermon's documentation on monitoring Spiders, in their examples, the monitors that they create seem to run across all of their Spiders, I can't figure out how to run a monitor on a single Spider.
I've tried passing my Spider into test_min_items, but I don't know where to set this.
from spidermon import Monitor, MonitorSuite, monitors
@monitors.name('Item count')
class ItemCountMonitor(Monitor):
@monitors.name('Minimum number of items')
def test_min_items(self):
item_extracted = getattr(
self.data.stats, 'item_scraped_count', 0)
minimum_threshold = 10
msg = 'Extracted less than {} items'.format(
minimum_threshold)
self.assertTrue(
item_extracted > minimum_threshold, msg=msg
)
class SpiderCloseMonitorSuite(MonitorSuite):
monitors = [
ItemCountMonitor
]