

@mock.patch('sys.argv')
def test_command_error_usage_prog(self, argv_mock):
    argv_mock.__getitem__.return_value = '/usr/bin/foo'
    cmd = commands.Command()
    self.add_argument('--bar', required=True)
    with self.assertRaises(SystemExit):
        cmd.parse([])
    self.exit_mock.assert_called_once_with(mock.ANY, mock.ANY, 'usage: foo --bar BAR')
    self.exit_mock.reset_mock()
    with self.assertRaises(SystemExit):
        cmd.parse([], prog='baz')
    self.exit_mock.assert_called_once_with(mock.ANY, mock.ANY, 'usage: baz --bar BAR')

dataset/ETHPy150Open mopidy/mopidy/tests/test_commands.py CommandParsingTest.test_command_error_usage_prog/VarMisuse@36/57 `cmd`->`self`