Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

test: list appears in ValueError Exception message

Ammar Najjar5ab1a318e8a8
diff --git a/scrapy/utils/conf.py b/scrapy/utils/conf.py
index afd8f5374..4e7a9967e 100644
--- a/scrapy/utils/conf.py
+++ b/scrapy/utils/conf.py
@@ -17,7 +17,7 @@ def build_component_list(compdict, custom=None, convert=update_classpath):
def _check_components(complist):
if len({convert(c) for c in complist}) != len(complist):
- raise ValueError('Some paths in {complist!r} convert to the same object, '
+ raise ValueError(f'Some paths in {complist!r} convert to the same object, '
'please update your settings')
def _map_keys(compdict):
diff --git a/tests/test_utils_conf.py b/tests/test_utils_conf.py
index ccc65c4fd..061bc8c7c 100644
--- a/tests/test_utils_conf.py
+++ b/tests/test_utils_conf.py
@@ -50,8 +50,9 @@ class BuildComponentListTest(unittest.TestCase):
def test_duplicate_components_in_list(self):
duplicate_list = ['a', 'b', 'a']
- self.assertRaises(ValueError, build_component_list, None,
- duplicate_list, convert=lambda x: x)
+ with self.assertRaises(ValueError) as cm:
+ build_component_list(None, duplicate_list, convert=lambda x: x)
+ self.assertIn(str(duplicate_list), str(cm.exception))
def test_duplicate_components_in_basesettings(self):
# Higher priority takes precedence