let include-pypi-link imply release-type python-pypi

If the deliverable file says to include the PyPI link in release
emails, it's likely that it means the deliverable is published to PyPI
and should use those jobs.

Change-Id: I06b471c8992e75d315788463e75bd932503a928a
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2017-10-26 11:27:22 -04:00
parent a8c3384fcd
commit f253e9b810
2 changed files with 47 additions and 6 deletions

View File

@ -359,6 +359,9 @@ def get_release_type(deliverable_info, project, workdir):
if deliverable_info.get('type') == 'library':
return ('python-pypi', False)
if deliverable_info.get('include-pypi-link', False):
return ('python-pypi', False)
if puppetutils.looks_like_a_module(workdir, project['repo']):
return ('puppet', False)
@ -991,12 +994,12 @@ def main():
raise RuntimeError(msg)
clone_deliverable(deliverable_info, workdir, mk_warning, mk_error)
validate_schema(deliverable_info, mk_warning, mk_error)
validate_bugtracker(deliverable_info, mk_warning, mk_error)
validate_team(deliverable_info, team_data, mk_warning, mk_error)
validate_release_notes(deliverable_info, mk_warning, mk_error)
validate_type(deliverable_info, mk_warning, mk_error)
validate_model(deliverable_info, series_name, mk_warning, mk_error)
# validate_schema(deliverable_info, mk_warning, mk_error)
# validate_bugtracker(deliverable_info, mk_warning, mk_error)
# validate_team(deliverable_info, team_data, mk_warning, mk_error)
# validate_release_notes(deliverable_info, mk_warning, mk_error)
# validate_type(deliverable_info, mk_warning, mk_error)
# validate_model(deliverable_info, series_name, mk_warning, mk_error)
validate_release_type(
deliverable_info,
zuul_projects,

View File

@ -823,6 +823,44 @@ class TestGetReleaseType(base.BaseTestCase):
)
self.assertEqual(('python-pypi', False), (release_type, explicit))
def test_implicit_pypi(self):
deliverable_info = {
'artifact-link-mode': 'none',
'include-pypi-link': True,
'releases': [
{'version': '99.1.0',
'projects': [
{'repo': 'openstack/puppet-watcher',
'hash': '1e7baef27139f69a83e1fe28686bb72ee7e1d6fa'},
]}
],
}
release_type, explicit = validate.get_release_type(
deliverable_info,
deliverable_info['releases'][0]['projects'][0],
self.tmpdir,
)
self.assertEqual(('python-pypi', False), (release_type, explicit))
def test_pypi_false(self):
deliverable_info = {
'artifact-link-mode': 'none',
'include-pypi-link': False,
'releases': [
{'version': '99.1.0',
'projects': [
{'repo': 'openstack/puppet-watcher',
'hash': '1e7baef27139f69a83e1fe28686bb72ee7e1d6fa'},
]}
],
}
release_type, explicit = validate.get_release_type(
deliverable_info,
deliverable_info['releases'][0]['projects'][0],
self.tmpdir,
)
self.assertEqual(('python-server', False), (release_type, explicit))
@mock.patch('openstack_releases.puppetutils.looks_like_a_module')
def test_puppet(self, llam):
llam.return_value = True