Skip to content

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

Add missing f-string prefix to genspider output

Valdir Stumm Juniora2c4a7f9200a
diff --git a/scrapy/commands/genspider.py b/scrapy/commands/genspider.py
index 72248bded..5f44daa70 100644
--- a/scrapy/commands/genspider.py
+++ b/scrapy/commands/genspider.py
@@ -98,7 +98,7 @@ class Command(ScrapyCommand):
print(f"Created spider {name!r} using template {template_name!r} ",
end=('' if spiders_module else '\n'))
if spiders_module:
- print("in module:\n {spiders_module.__name__}.{module}")
+ print(f"in module:\n {spiders_module.__name__}.{module}")
def _find_template(self, template):
template_file = join(self.templates_dir, f'{template}.tmpl')
diff --git a/tests/test_commands.py b/tests/test_commands.py
index 85aee55a5..d3ac05eac 100644
--- a/tests/test_commands.py
+++ b/tests/test_commands.py
@@ -389,8 +389,9 @@ class GenspiderCommandTest(CommandTest):
def test_template(self, tplname='crawl'):
args = [f'--template={tplname}'] if tplname else []
spname = 'test_spider'
+ spmodule = f"{self.project_name}.spiders.{spname}"
p, out, err = self.proc('genspider', spname, 'test.com', *args)
- self.assertIn(f"Created spider {spname!r} using template {tplname!r} in module", out)
+ self.assertIn(f"Created spider {spname!r} using template {tplname!r} in module:{os.linesep} {spmodule}", out)
self.assertTrue(exists(join(self.proj_mod_path, 'spiders', 'test_spider.py')))
modify_time_before = getmtime(join(self.proj_mod_path, 'spiders', 'test_spider.py'))
p, out, err = self.proc('genspider', spname, 'test.com', *args)