Exemplo n.º 1
0
def test_invalid_part(caplog):
    with pytest.raises(argparse.ArgumentError):
        main(['foo'])
Exemplo n.º 2
0
def test_abort(caplog):
    with mock.patch('piwheels.terminal.yes_no_prompt') as prompt_mock:
        prompt_mock.return_value = False
        assert main(['index']) == 2
    assert find_message(caplog.records, message='User aborted rebuild')
Exemplo n.º 3
0
def test_help(capsys):
    with pytest.raises(SystemExit):
        main(['--help'])
    out, err = capsys.readouterr()
    assert out.startswith('usage:')
    assert '--yes' in out
Exemplo n.º 4
0
def test_version(capsys):
    with pytest.raises(SystemExit):
        main(['--version'])
    out, err = capsys.readouterr()
    assert out.strip() == __version__
Exemplo n.º 5
0
 def capture_exc(self, args):
     try:
         self.exitcode = main(args)
     except Exception as e:
         self.exception = e