Skip to content

Commit

Permalink
test(spiderloader): no duplicate spider names (#4560)
Browse files Browse the repository at this point in the history
  • Loading branch information
adityaa30 committed May 12, 2020
1 parent cf9be53 commit 97532a9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/test_spiderloader/__init__.py
Expand Up @@ -137,6 +137,11 @@ def test_dupename_warning(self):
msg = str(w[0].message)
self.assertIn("several spiders with the same name", msg)
self.assertIn("'spider3'", msg)
self.assertTrue(msg.count("'spider3'") == 2)

self.assertNotIn("'spider1'", msg)
self.assertNotIn("'spider2'", msg)
self.assertNotIn("'spider4'", msg)

spiders = set(spider_loader.list())
self.assertEqual(spiders, set(['spider1', 'spider2', 'spider3', 'spider4']))
Expand All @@ -156,7 +161,13 @@ def test_multiple_dupename_warning(self):
msg = str(w[0].message)
self.assertIn("several spiders with the same name", msg)
self.assertIn("'spider1'", msg)
self.assertTrue(msg.count("'spider1'") == 2)

self.assertIn("'spider2'", msg)
self.assertTrue(msg.count("'spider2'") == 2)

self.assertNotIn("'spider3'", msg)
self.assertNotIn("'spider4'", msg)

spiders = set(spider_loader.list())
self.assertEqual(spiders, set(['spider1', 'spider2', 'spider3', 'spider4']))

0 comments on commit 97532a9

Please sign in to comment.