def test_help(capsys): with pytest.raises(SystemExit): main(['--help']) out, err = capsys.readouterr() assert out.startswith('usage:') assert '--package' in out assert '--package-version' in out assert '--abi' in out
def test_import_no_abi(mock_wheel_no_abi, mock_wheel_stats, import_queue_name, import_queue): mock_wheel = mock_wheel_no_abi with pytest.raises(RuntimeError): main(['-y', '--import-queue', import_queue_name, mock_wheel])
def test_manual_package_version(mock_wheel, caplog): with mock.patch('piwheels.terminal.yes_no_prompt') as prompt_mock: prompt_mock.return_value = False main(['--package', 'bar', '--package-version', '0.2', mock_wheel]) assert find_message(caplog.records, message='Package: bar') assert find_message(caplog.records, message='Version: 0.2')
def test_auto_package_version(mock_wheel, caplog): with mock.patch('piwheels.terminal.yes_no_prompt') as prompt_mock: prompt_mock.return_value = False main([mock_wheel]) assert find_message(caplog.records, message='Package: foo') assert find_message(caplog.records, message='Version: 0.1')
def test_abort(mock_wheel): with mock.patch('piwheels.terminal.yes_no_prompt') as prompt_mock: prompt_mock.return_value = False assert main([mock_wheel]) == 2
def test_version(capsys): with pytest.raises(SystemExit): main(['--version']) out, err = capsys.readouterr() assert out.strip() == __version__
def capture_exc(self, args): try: self.exitcode = main(args) except Exception as e: self.exception = e