summaryrefslogtreecommitdiff
path: root/framework/status.py
diff options
context:
space:
mode:
authorDylan Baker <baker.dylan.c@gmail.com>2013-09-30 14:20:54 -0700
committerDylan Baker <baker.dylan.c@gmail.com>2013-10-31 12:13:40 -0700
commit7249b0681806059f4af3b3f84457ce2955d6015e (patch)
treea03a86748a65110ba78fc4854ab86068281469a5 /framework/status.py
parenta559fbf6cfa5a30e064694b0c46c1d57dd68c7c3 (diff)
summary.py: Replace buildDictionary function with a much simpler method
This patch produces the exact same output as the previous approach, just in a much simpler way. It also moves some more of the status information out of if branches and into the Status class in the status module. There are a few side effects of using a defaultdict class, namely that they do not generate a KeyError when one calls for a non existent key. This means there are a couple of places where try/except blocks are replaced by if checks. v2: - fix HTMLIndex._groupResult() - don't overwrite the previous status with skip - Use a helper function to reduce code duplication Tested-by: Ben Widawsky <ben@bwidawsk.net> Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
Diffstat (limited to 'framework/status.py')
-rw-r--r--framework/status.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/framework/status.py b/framework/status.py
index a2653173b..2fe153eeb 100644
--- a/framework/status.py
+++ b/framework/status.py
@@ -104,10 +104,11 @@ class Status(object):
# Using __slots__ allows us to implement the flyweight pattern, limiting
# the memory consumed for creating tens of thousands of these objects.
- __slots__ = ['name', 'value']
+ __slots__ = ['name', 'value', 'fraction']
name = None
value = None
+ fraction = (0, 1)
def __init__(self):
raise NotImplementedError
@@ -149,6 +150,7 @@ class Status(object):
class NotRun(Status):
name = 'Not Run'
value = 0
+ fraction = (0, 0)
def __init__(self):
pass
@@ -157,6 +159,7 @@ class NotRun(Status):
class Pass(Status):
name = 'pass'
value = 10
+ fraction = (1, 1)
def __init__(self):
pass
@@ -205,6 +208,7 @@ class Crash(Status):
class Skip(Status):
name = 'skip'
value = 50
+ fraction = (0, 0)
def __init__(self):
pass