Merge pull request #127 from aplanas/master

Multiple fixes
This commit is contained in:
Stephan Kulow 2014-03-28 20:17:42 +01:00
commit 1677186e27
4 changed files with 8 additions and 10 deletions

View File

@ -6,6 +6,8 @@ python:
install:
- pip install python-coveralls
- pip install -r requirements.txt
- sudo mkdir -p /var/cache/repo-checker
- sudo chown $USER /var/cache/repo-checker
# command to run tests, e.g. python setup.py test
script:
- nosetests --with-coverage --cover-package=oscs,osclib --cover-inclusive

View File

@ -92,7 +92,7 @@ def do_staging(self, subcmd, opts, *args):
raise oscerr.WrongArgs('Unknown command: %s' % cmd)
if len(args) - 1 < min_args:
raise oscerr.WrongArgs('Too few arguments.')
if not max_args is None and len(args) - 1 > max_args:
if max_args is not None and len(args) - 1 > max_args:
raise oscerr.WrongArgs('Too many arguments.')
# init the obs access

View File

@ -56,10 +56,6 @@ class RequestFinder(object):
:param element: XML with list of reviews
"""
reviews = self._filter_review_by_project(element, 'new')
# First filter out reviews to contain only STAGING ones
# NOTE: this is hardcoded path to projects so usage elsewhere
# will need adjustements
reviews = [prj for prj in reviews if prj.startswith('openSUSE:Factory:Staging:')]
assert len(reviews) <= 1, 'Request "{}" have multiple review by project in new state "{}"'.format(request_id,
reviews)
return reviews[0] if reviews else None
@ -92,7 +88,7 @@ class RequestFinder(object):
self.srs[int(request_id)] = {'project': project}
review = self._new_review_by_project(request_id, root)
if review:
if review and review.startswith(STG_PREFIX):
self.srs[int(request_id)]['staging'] = review
return True
@ -123,7 +119,7 @@ class RequestFinder(object):
self.srs[request] = {'project': 'openSUSE:Factory', 'state': state}
review = self._new_review_by_project(request, sr)
if review:
if review and review.startswith(STG_PREFIX):
self.srs[int(request)]['staging'] = review
if last_rq:
@ -163,7 +159,7 @@ class RequestFinder(object):
state = sr.find('state').get('name')
self.srs[request] = {'project': 'openSUSE:Factory', 'state': state}
review = self._new_review_by_project(request, sr)
if review:
if review and review.startswith(STG_PREFIX):
self.srs[int(request)]['staging'] = review
ret = True

View File

@ -4,7 +4,7 @@ from osc import oscerr
from osc.core import http_GET
from osclib.request_finder import RequestFinder
from osclib.freeze_command import FreezeCommand
# from osclib.freeze_command import FreezeCommand
class SelectCommand(object):
@ -98,7 +98,7 @@ class SelectCommand(object):
# If the project is not frozen enough yet freeze it
if not self.api.prj_frozen_enough(target_project):
print('Freeze the prj first')
#FreezeCommand(self.api).perform(target_project)
# FreezeCommand(self.api).perform(target_project)
self.target_project = target_project
for request, request_project in RequestFinder.find_sr(requests, self.api.apiurl).items():