Skip to content
Snippets Groups Projects
Commit eab228dc authored by Christian Stenger's avatar Christian Stenger
Browse files

Squish: Cleanup workarounds.py


* removed fetching status
* improved output for closed bugs

Change-Id: Ice0256f75571c6c44e9878447d3821247f5ded4f
Reviewed-by: default avatarRobert Loehning <robert.loehning@digia.com>
parent 59edc405
No related branches found
No related tags found
No related merge requests found
......@@ -22,7 +22,7 @@ class JIRA:
else:
JIRA.__instance__._bugType = bugType
JIRA.__instance__._number = number
JIRA.__instance__.__fetchStatusAndResolutionFromJira__()
JIRA.__instance__.__fetchResolutionFromJira__()
# overriden to make it possible to use JIRA just like the
# underlying implementation (__impl)
......@@ -56,7 +56,7 @@ class JIRA:
if JIRA.isBugStillOpen(number, bugType):
return JIRA.performWorkaroundForBug(number, bugType, *args)
else:
test.warning("Bug is closed... skipping workaround!",
test.warning("Bug %s-%d is closed... skipping workaround!" % (bugType, number),
"You should remove potential code inside performWorkaroundForBug()")
return False
......@@ -82,7 +82,7 @@ class JIRA:
self._localOnly = os.getenv("SYSTEST_JIRA_NO_LOOKUP")=="1"
self.__initBugDict__()
self._fetchResults_ = {}
self.__fetchStatusAndResolutionFromJira__()
self.__fetchResolutionFromJira__()
# this function checks the resolution of the given bug
# and returns True if the bug can still be assumed as 'Open' and False otherwise
......@@ -96,16 +96,15 @@ class JIRA:
return True
return self._resolution != 'Done'
# this function tries to fetch the status and resolution from JIRA for the given bug
# this function tries to fetch the resolution from JIRA for the given bug
# if this isn't possible or the lookup is disabled it does only check the internal
# dict whether a function for the given bug is deposited or not
def __fetchStatusAndResolutionFromJira__(self):
def __fetchResolutionFromJira__(self):
global JIRA_URL
bug = "%s-%d" % (self._bugType, self._number)
if bug in self._fetchResults_:
result = self._fetchResults_[bug]
self._resolution = result[0]
self._status = result[1]
self._resolution = result
return
data = None
proxy = os.getenv("SYSTEST_PROXY", None)
......@@ -129,7 +128,6 @@ class JIRA:
if bug in self.__bugs__:
test.warning("Using internal dict - bug status could have changed already",
"Please check manually!")
self._status = None
self._resolution = None
else:
test.fatal("No workaround function deposited for %s" % bug)
......@@ -137,24 +135,16 @@ class JIRA:
else:
data = data.replace("\r", "").replace("\n", "")
resPattern = re.compile('<span\s+id="resolution-val".*?>(?P<resolution>.*?)</span>')
statPattern = re.compile('<span\s+id="status-val".*?>(.*?<img.*?>)?(?P<status>.*?)</span>')
status = statPattern.search(data)
resolution = resPattern.search(data)
if status:
self._status = status.group("status").strip()
else:
test.fatal("FATAL: Cannot get status of bugreport %s" % bug,
"Looks like JIRA has changed.... Please verify!")
self._status = None
if resolution:
self._resolution = resolution.group("resolution").strip()
else:
test.fatal("FATAL: Cannot get resolution of bugreport %s" % bug,
"Looks like JIRA has changed.... Please verify!")
self._resolution = None
if None in (self._status, self._resolution):
if self._resolution == None:
self.__cropAndLog__(data)
self._fetchResults_.update({bug:[self._resolution, self._status]})
self._fetchResults_.update({bug:self._resolution})
# simple helper function - used as fallback if python has no ssl support
# tries to find curl or wget in PATH and fetches data with it instead of
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment