def _run_test(self, manifest_path, manifest): with mock.patch('ship_it.validate_path'), \ mock.patch('ship_it.cli'), \ mock.patch('ship_it._package_virtualenv_with_manifest'), \ mock.patch('ship_it.get_version_from_setup_py') as mocked_get, \ mock.patch('ship_it.get_manifest_from_path', return_value=manifest) as mocked: assert not mocked_get.called fpm(manifest_path) return mocked_get
def _populate_manifest_and_invoke_fpm(iteration): import sideboard with open(MANIFEST_TEMPLATE) as f: manifest = yaml.load(f) manifest[b'version'] = sideboard.__version__ manifest[b'iteration'] = iteration with open(MANIFEST_YAML, 'w') as f: yaml.dump(manifest, f) ship_it.fpm(MANIFEST_YAML)
def test_manifest_calls(mock_cl, mock_get, mock_invoke, mock_val, mock_pack, mock_patch, manifest): """ Does the fpm task do the things we expect in the order we expect? """ mocked_functions = [mock_cl, mock_get, mock_invoke, mock_val, mock_pack, mock_patch] assert all(not mocked.called for mocked in mocked_functions) with mock.patch('ship_it.get_manifest_from_path', return_value=manifest): ship_it.fpm(manifest.path, overridden='flag') assert all(mocked.called for mocked in mocked_functions) assert mock_val.mock_calls == [mock.call('/test_dir/manifest.yaml')] mock_cl.assert_called_once_with(['arg'], [('version', '1.2.3'), ('overridden', 'flag')]) mock_invoke.assert_called_once_with('command line')
def main(manifest, requirements, setup): fpm(manifest, requirements, setup)