Skip to content

Commit

Permalink
Merge pull request #5482 from alexpdev/parse_help_msg
Browse files Browse the repository at this point in the history
Fix TypeError in parse command
  • Loading branch information
wRAR committed Apr 29, 2022
2 parents aead27b + 915c288 commit b9b9422
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion scrapy/commands/parse.py
Expand Up @@ -51,7 +51,7 @@ def add_options(self, parser):
parser.add_argument("--cbkwargs", dest="cbkwargs",
help="inject extra callback kwargs into the Request, it must be a valid raw json string")
parser.add_argument("-d", "--depth", dest="depth", type=int, default=1,
help="maximum depth for parsing requests [default: %default]")
help="maximum depth for parsing requests [default: %(default)s]")
parser.add_argument("-v", "--verbose", dest="verbose", action="store_true",
help="print each depth level one by one")

Expand Down
14 changes: 14 additions & 0 deletions tests/test_commands.py
Expand Up @@ -930,3 +930,17 @@ def start_requests(self):
args = ['-o', 'example1.json', '-O', 'example2.json']
log = self.get_log(spider_code, args=args)
self.assertIn("error: Please use only one of -o/--output and -O/--overwrite-output", log)


class HelpMessageTest(CommandTest):

def setUp(self):
super().setUp()
self.commands = ["parse", "startproject", "view", "crawl", "edit",
"list", "fetch", "settings", "shell", "runspider",
"version", "genspider", "check", "bench"]

def test_help_messages(self):
for command in self.commands:
_, out, _ = self.proc(command, "-h")
self.assertIn("Usage", out)

0 comments on commit b9b9422

Please sign in to comment.