2 new revisions:
Revision: ceca767fd872
Author: Janne Härkönen <[email protected]>
Date: Fri Nov 11 04:02:55 2011
Log: old statistics: API comptaibility with new model
http://code.google.com/p/robotframework/source/detail?r=ceca767fd872
Revision: 443628168dff
Author: Janne Härkönen <[email protected]>
Date: Fri Nov 11 04:03:06 2011
Log: statistics: cleanup
http://code.google.com/p/robotframework/source/detail?r=443628168dff
==============================================================================
Revision: ceca767fd872
Author: Janne Härkönen <[email protected]>
Date: Fri Nov 11 04:02:55 2011
Log: old statistics: API comptaibility with new model
http://code.google.com/p/robotframework/source/detail?r=ceca767fd872
Modified:
/src/robot/common/statistics.py
=======================================
--- /src/robot/common/statistics.py Thu Nov 3 06:05:49 2011
+++ /src/robot/common/statistics.py Fri Nov 11 04:02:55 2011
@@ -15,6 +15,7 @@
import re
from robot import utils
+from robot.model.tags import TagPatterns
class Statistics:
@@ -233,7 +234,7 @@
self.stats[name] = TagStat(name, self._get_doc(name),
self._get_links(name),
combined=pattern)
- if test.is_included([pattern], []):
+ if TagPatterns(pattern).match(test.tags):
self.stats[name].add_test(test)
def serialize(self, serializer):
==============================================================================
Revision: 443628168dff
Author: Janne Härkönen <[email protected]>
Date: Fri Nov 11 04:03:06 2011
Log: statistics: cleanup
http://code.google.com/p/robotframework/source/detail?r=443628168dff
Modified:
/src/robot/model/statistics.py
/utest/model/test_statistics.py
=======================================
--- /src/robot/model/statistics.py Fri Nov 11 02:18:06 2011
+++ /src/robot/model/statistics.py Fri Nov 11 04:03:06 2011
@@ -21,11 +21,11 @@
class StatisticsBuilder(SuiteVisitor):
- def __init__(self, stats):
- self._stats = stats
+ def __init__(self, suite_stats, tag_stats):
+ self._current_suite_stat = suite_stats
+ self._tag_stats = tag_stats
self._parents = []
self._first = True
- self._current_suite_stat = self._stats.suite
def start_suite(self, suite):
if not self._first:
@@ -44,18 +44,17 @@
def start_test(self, test):
self._current_suite_stat.add_test(test)
- self._stats.tags.add_test(test, self._current_suite.critical)
+ self._tag_stats.add_test(test, self._current_suite.critical)
class Statistics(object):
- def __init__(self, suite, suite_stat_level=-1, tag_stat_include=None,
- tag_stat_exclude=None, tag_stat_combine=None,
tag_doc=None,
- tag_stat_link=None):
+ def __init__(self, suite, tag_stat_include=None, tag_stat_exclude=None,
+ tag_stat_combine=None, tag_doc=None, tag_stat_link=None):
+ self.suite = SuiteStatistics(suite)
self.tags = TagStatistics(tag_stat_include, tag_stat_exclude,
tag_stat_combine, tag_doc, tag_stat_link)
- self.suite = SuiteStatistics(suite, suite_stat_level)
- StatisticsBuilder(self).visit_suite(suite)
+ StatisticsBuilder(self.suite, self.tags).visit_suite(suite)
self.tags.sort()
self.total = TotalStatistics(self.suite)
@@ -71,30 +70,18 @@
self.serialize(visitor)
-class SuiteStatistics:
-
- def __init__(self, suite, suite_stat_level=-1):
+class SuiteStatistics(object):
+
+ def __init__(self, suite):
self.all = SuiteStat(suite)
self.critical = SuiteStat(suite)
self.suites = []
- self._suite_stat_level = suite_stat_level
def add_test(self, test):
self.all.add_test(test)
if test.critical == 'yes':
self.critical.add_test(test)
- def serialize(self, serializer):
- serializer.start_suite_stats(self)
- self._serialize(serializer, self._suite_stat_level)
- serializer.end_suite_stats(self)
-
- def _serialize(self, serializer, max_suite_level, suite_level=1):
- self.all.serialize(serializer)
- if max_suite_level < 0 or max_suite_level > suite_level:
- for suite in self.suites:
- suite._serialize(serializer, max_suite_level,
suite_level+1)
-
class Stat(object):
=======================================
--- /utest/model/test_statistics.py Fri Nov 11 01:36:26 2011
+++ /utest/model/test_statistics.py Fri Nov 11 04:03:06 2011
@@ -255,7 +255,7 @@
def test_through_suite(self):
suite = generate_default_suite()
suite.set_criticality(critical_tags=['smoke'])
- statistics = Statistics(suite, -1, ['t*','smoke'], ['t3'],
+ statistics = Statistics(suite, ['t*','smoke'], ['t3'],
[('t1 & t2', ''), ('t? & smoke', ''),
('t1 NOT t2', ''), ('none & t1', 'a
title')])
stats = sorted(statistics.tags.stats.values())