Add missing f-string prefix to genspider output

This commit is contained in:
Valdir Stumm Junior 2020-11-08 19:12:18 -03:00
parent c292957cb1
commit a2c4a7f920
2 changed files with 3 additions and 2 deletions

View File

@ -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')

View File

@ -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)