diff options
author | Martin Sivak <msivak@redhat.com> | 2010-09-08 14:28:25 +0200 |
---|---|---|
committer | Martin Sivak <msivak@redhat.com> | 2010-09-08 14:28:25 +0200 |
commit | 13ce1b07f909e34e32f2299f35696290789c2ee9 (patch) | |
tree | b8a288ca496c8999763e708f2c0f29212e3abf2b /pyfirstaidkit/issue.py | |
parent | cf7c1bfe2e9619dce8a7e4b2bf6a30f0dc1bc9db (diff) | |
download | firstaidkit-13ce1b07f909e34e32f2299f35696290789c2ee9.tar.gz firstaidkit-13ce1b07f909e34e32f2299f35696290789c2ee9.tar.xz firstaidkit-13ce1b07f909e34e32f2299f35696290789c2ee9.zip |
Support error and skipped states in issues, show progress in status bar
Diffstat (limited to 'pyfirstaidkit/issue.py')
-rw-r--r-- | pyfirstaidkit/issue.py | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/pyfirstaidkit/issue.py b/pyfirstaidkit/issue.py index b4bcee2..4376964 100644 --- a/pyfirstaidkit/issue.py +++ b/pyfirstaidkit/issue.py @@ -31,8 +31,11 @@ class SimpleIssue(object): self._happened = False self._fixed = False self._exception = None + self._error = False + self._skipped = False def set(self, happened = None, fixed = None, checked = None, + skipped = None, error = None, reporting = None, **kwreportingargs): """Set the state of this issue and send a report @@ -43,6 +46,10 @@ class SimpleIssue(object): self._fixed = fixed if checked: self._checked = checked + if error: + self._error = error + if skipped: + self._skipped = skipped if reporting: reporting.issue(issue = self, **kwreportingargs) @@ -54,7 +61,7 @@ Return values: False - NO, it is OK None - I don't know, there was an error""" #if the issue was fixed or not checked, the check si needed - if not self._checked or self._fixed: + if not self._checked or self._error or self._skipped or self._fixed: return None else: return self._happened @@ -67,15 +74,25 @@ Return values: False - NO, it is still broken None - I don't know""" #if the issue was not checked, the check si needed - if not self._checked: + if not self._checked or self._error or self._skipped: return None else: #issue didn't happened or is fixed -> True return not self._happened or self._fixed + def skipped(self): + return self._skipped + + def error(self): + return self._error + def __str__(self): s = [] - if self._fixed: + if self._error: + s.append("Error evaluating") + elif self._skipped: + s.append("Skipped checking of") + elif self._fixed: s.append("Fixed") elif self._happened and self._checked: s.append("Detected") @@ -86,7 +103,8 @@ Return values: s.append(self.name) - if self._happened and self._checked: + if not self._error and not self._skipped and \ + self._happened and self._checked: s.append("--") s.append(self.description) |