MCPcopy Index your code
hub / github.com/pyinvoke/invoke / ParseErrors_display_message_and_exit_1

Method ParseErrors_display_message_and_exit_1

tests/program.py:392–404  ·  view source on GitHub ↗
(self, mock_exit)

Source from the content-addressed store, hash-verified

390 @trap
391 @patch("invoke.program.sys.exit")
392 def ParseErrors_display_message_and_exit_1(self, mock_exit):
393 p = Program()
394 # Run with a definitely-parser-angering incorrect input; the fact
395 # that this line doesn't raise an exception and thus fail the
396 # test, is what we're testing...
397 nah = "nopenotvalidsorry"
398 p.run("myapp {}".format(nah))
399 # Expect that we did print the core body of the ParseError (e.g.
400 # "no idea what foo is!") and exit 1. (Intent is to display that
401 # info w/o a full traceback, basically.)
402 stderr = sys.stderr.getvalue()
403 assert stderr == "No idea what '{}' is!\n".format(nah)
404 mock_exit.assert_called_with(1)
405
406 @trap
407 @patch("invoke.program.sys.exit")

Callers

nothing calls this directly

Calls 2

runMethod · 0.95
ProgramClass · 0.90

Tested by

no test coverage detected