def METHOD_NAME(self):
    # copy 2 spider modules so as to have duplicate spider name
    # This should issue 2 warning, 1 for each duplicate spider name
    shutil.copyfile(
        self.tmpdir / "test_spiders_xxx" / "spider1.py",
        self.tmpdir / "test_spiders_xxx" / "spider1dupe.py",
    )
    shutil.copyfile(
        self.tmpdir / "test_spiders_xxx" / "spider2.py",
        self.tmpdir / "test_spiders_xxx" / "spider2dupe.py",
    )
    with warnings.catch_warnings(record=True) as w:
        spider_loader = SpiderLoader.from_settings(self.settings)
        self.assertEqual(len(w), 1)
        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, {"spider1", "spider2", "spider3", "spider4"})