6 new revisions:

Revision: 70aca66a29b2
Author:   Pekka Klärck
Date:     Mon Jun 20 08:41:50 2011
Log:      whitespace
http://code.google.com/p/robotframework/source/detail?r=70aca66a29b2

Revision: ddcf407753f3
Author:   Pekka Klärck
Date:     Mon Jun 20 09:06:50 2011
Log: get default value of tagstatcombine title only in stats, not in settin...
http://code.google.com/p/robotframework/source/detail?r=ddcf407753f3

Revision: 3d9804ff8930
Author:   Pekka Klärck
Date:     Mon Jun 20 09:07:26 2011
Log: fixed statistics tests after refactoring and removed dead code from mo...
http://code.google.com/p/robotframework/source/detail?r=3d9804ff8930

Revision: ccc4fe10ddd4
Author:   Pekka Klärck
Date:     Mon Jun 20 09:24:47 2011
Log:      no douple spaces around AND
http://code.google.com/p/robotframework/source/detail?r=ccc4fe10ddd4

Revision: bd9af7a1a75f
Author:   Pekka Klärck
Date:     Mon Jun 20 09:25:25 2011
Log:      fixed tag doc tests with rebot and added one more test
http://code.google.com/p/robotframework/source/detail?r=bd9af7a1a75f

Revision: b4f63c715803
Author:   Pekka Klärck
Date:     Mon Jun 20 09:45:44 2011
Log:      fixed escaping doc and metadata from cli
http://code.google.com/p/robotframework/source/detail?r=b4f63c715803

==============================================================================
Revision: 70aca66a29b2
Author:   Pekka Klärck
Date:     Mon Jun 20 08:41:50 2011
Log:      whitespace
http://code.google.com/p/robotframework/source/detail?r=70aca66a29b2

Modified:
 /utest/common/test_statistics.py

=======================================
--- /utest/common/test_statistics.py    Thu Jun 16 11:24:17 2011
+++ /utest/common/test_statistics.py    Mon Jun 20 08:41:50 2011
@@ -23,22 +23,22 @@
         if separator is None:
             return self.name.split('.')
         return self.name.replace('.', separator)
-
+
     def get_medium_name(self, separator='.'):
         parts = self.name.split('.')
-        return '.'.join([ i[0].lower() for i in parts[:-1] ] + [parts[-1]])
-
+        return '.'.join([i[0].lower() for i in parts[:-1]] + [parts[-1]])
+
     def add_suite(self, name):
         suite = SuiteMock(name, self.critical.tags)
         self.suites.append(suite)
         return suite
-
+
     def add_test(self, status, tags=None):
-        test = TestMock(status, tags,
+        test = TestMock(status, tags,
                         self.critical.are_critical(tags or []))
         self.tests.append(test)
         return test
-
+

 class TestMock(BaseTestCase):

@@ -57,7 +57,7 @@
         assert_equals(stat.critical, critical)
     if non_crit is not None:
         assert_equals(stat.non_critical, non_crit)
-
+
def verify_suite(suite, name, crit_pass, crit_fail, all_pass=None, all_fail=None):
     verify_stat(suite.critical, name, crit_pass, crit_fail)
     if all_pass is None:
@@ -79,36 +79,36 @@
     s12.add_test('FAIL', ['t1','t2','t3','smoke'])
     s13.add_test('PASS', ['t1','t2','smoke'])
     s21.add_test('FAIL', ['t3','smoke'])
-    return suite
+    return suite


 class TestStatisticsSimple(unittest.TestCase):
-
+
     def setUp(self):
         suite = SuiteMock('Hello')
- suite.tests = [ TestMock('PASS'), TestMock('PASS'), TestMock('FAIL') ] + suite.tests = [TestMock('PASS'), TestMock('PASS'), TestMock('FAIL')]
         self.statistics = Statistics(suite)
-
+
     def test_total(self):
         verify_stat(self.statistics.total.critical, 'Critical Tests', 2, 1)
         verify_stat(self.statistics.total.all, 'All Tests', 2, 1)
-
+
     def test_suite(self):
         verify_suite(self.statistics.suite, 'Hello', 2, 1)
-
+
     def test_tags(self):
         assert_equals(self.statistics.tags.stats, {})

-
+
 class TestStatisticsNotSoSimple(unittest.TestCase):
-
+
     def setUp(self):
         self.statistics = Statistics(generate_default_suite())

     def test_total(self):
         verify_stat(self.statistics.total.all, 'All Tests', 4, 3)
         verify_stat(self.statistics.total.critical, 'Critical Tests', 2, 2)
-
+
     def test_suite(self):
         suite = self.statistics.suite
         verify_suite(suite, 'Root Suite', 2, 2, 4, 3)
@@ -135,71 +135,68 @@
         assert_equals(keys, 'smoke t1 t2 t3'.split())
         verify_stat(tags.stats['smoke'], 'smoke', 2, 2, True, False)
         verify_stat(tags.stats['t1'], 't1', 3, 2, False, False)
-        verify_stat(tags.stats['t2'], 't2', 2, 1, False, False)
-        verify_stat(tags.stats['t3'], 't3', 0, 2, False, False)
-
+        verify_stat(tags.stats['t2'], 't2', 2, 1, False, False)
+        verify_stat(tags.stats['t3'], 't3', 0, 2, False, False)
+

 _incl_excl_data = [
-        ( [], [] ),
-        ( [], ['t1','t2'] ),
-        ( ['t1'], ['t1','t2'] ),
-        ( ['t1','t2'], ['t1','t2','t3','t4'] ),
-        ( ['UP'], ['t1','t2','up'] ),
-        ( ['not','not2'], ['t1','t2','t3'] ),
-        ( ['t*'], ['t1','s1','t2','t3','s2','s3'] ),
-        ( ['T*','r'], ['t1','t2','r','teeeeeeee'] ),
-        ( ['*'], ['t1','t2','s1','tag'] ),
-        ( ['t1','t2','t3','not'], ['t1','t2','t3','t4','s1','s2'] )
+    ([], []),
+    ([], ['t1','t2']),
+    (['t1'], ['t1','t2']),
+    (['t1','t2'], ['t1','t2','t3','t4']),
+    (['UP'], ['t1','t2','up']),
+    (['not','not2'], ['t1','t2','t3']),
+    (['t*'], ['t1','s1','t2','t3','s2','s3']),
+    (['T*','r'], ['t1','t2','r','teeeeeeee']),
+    (['*'], ['t1','t2','s1','tag']),
+    (['t1','t2','t3','not'], ['t1','t2','t3','t4','s1','s2'])
 ]

-
-class TestTagStatistics(unittest.TestCase):
-
+
+class TestTagStatistics(unittest.TestCase):
+
     def test_include(self):
         for incl, tags in _incl_excl_data:
             tagstats = TagStatistics(incl, [])
             tagstats.add_test(TestMock('PASS', tags), _Critical())
-            keys = tagstats.stats.keys()
-            keys.sort()
-            tags.sort()
-            exp_keys = [ tag for tag in tags
-                         if incl == [] or utils.matches_any(tag, incl) ]
-            assert_equal(keys, exp_keys, "Incls: %s " % incl)
-
+            exp_keys = [tag for tag in sorted(tags)
+                        if incl == [] or utils.matches_any(tag, incl)]
+            assert_equal(sorted(tagstats.stats.keys()),
+                         exp_keys, "Incls: %s " % incl)
+
     def test_exclude(self):
         for excl, tags in _incl_excl_data:
             tagstats = TagStatistics([], excl)
             tagstats.add_test(TestMock('PASS', tags), _Critical())
-            keys = tagstats.stats.keys()
-            keys.sort()
-            tags.sort()
-            exp_keys = [ tag for tag in tags
-                         if not utils.matches_any(tag, excl) ]
-            assert_equal(keys, exp_keys, "Excls: %s" % excl)
+            exp_keys = [tag for tag in sorted(tags)
+                        if not utils.matches_any(tag, excl)]
+            assert_equal(sorted(tagstats.stats.keys()),
+                         exp_keys, "Excls: %s" % excl)

     def test_include_and_exclude(self):
         for incl, excl, tags, exp in [
-               ( [], [], ['t0','t1','t2'], ['t0','t1','t2'] ),
-               ( ['t1'], ['t2'], ['t0','t1','t2'], ['t1'] ),
-               ( ['t?'], ['t2'], ['t0','t1','t2','x'], ['t0','t1'] ),
-               ( ['t?'], ['*2'], ['t0','t1','t2','x2'], ['t0','t1'] ),
-               ( ['t1','t2'], ['t2'], ['t0','t1','t2'], ['t1'] ),
-               ( ['t1','t2','t3','not'], ['t2','t0'],
-                 ['t0','t1','t2','t3','x'], ['t1','t3'] ) ]:
+               ([], [], ['t0','t1','t2'], ['t0','t1','t2']),
+               (['t1'], ['t2'], ['t0','t1','t2'], ['t1']),
+               (['t?'], ['t2'], ['t0','t1','t2','x'], ['t0','t1']),
+               (['t?'], ['*2'], ['t0','t1','t2','x2'], ['t0','t1']),
+               (['t1','t2'], ['t2'], ['t0','t1','t2'], ['t1']),
+               (['t1','t2','t3','not'], ['t2','t0'],
+                ['t0','t1','t2','t3','x'], ['t1','t3'] )
+              ]:
             tagstats = TagStatistics(incl, excl)
             tagstats.add_test(TestMock('PASS', tags), _Critical())
-            keys = tagstats.stats.keys()
-            keys.sort()
-            assert_equal(keys, exp, "Incls: %s, Excls: %s" % (incl, excl))
+            assert_equal(sorted(tagstats.stats.keys()),
+                         exp, "Incls: %s, Excls: %s" % (incl, excl))

     def test_combine_with_name(self):
-        for comb_tags, expected_name in [
-                ( [], '' ),
-                ( ['t1&t2:my name'], 'my name' ),
-                ( ['t1NOTt3:Others'], 'Others' ),
-                ( ['1:2&2:3:nAme'], 'nAme' ),
-                ( ['3*'], '3*' ),
-                ( ['4NOT5:Some new name'], 'Some new name' )]:
+        for comb_tags, expected_name in [
+                ([], '' ),
+                (['t1&t2:my name'], 'my name'),
+                (['t1NOTt3:Others'], 'Others'),
+                (['1:2&2:3:nAme'], 'nAme'),
+                (['3*'], '3*' ),
+                (['4NOT5:Some new name'], 'Some new name')
+               ]:
             stats = TagStatistics(tag_stat_combine=comb_tags)
             test = TestMock()
             stats._add_tagstatcombine_statistics(test)
@@ -218,7 +215,7 @@
                 (['t*'], ['s','tee','t'], 1),
                 (['t*&s'], ['s','tee','t'], 1),
                 (['t*&s&non'], ['s','tee','t'], 0)
-                ]:
+               ]:
self._test_combined_statistics(comb_tags, test_tags, expected_count)

def _test_combined_statistics(self, comb_tags, test_tags, expected_count):
@@ -231,42 +228,42 @@
     def test_is_combined_with_not_statements(self):
         stats = TagStatistics()
         for comb_tags, test_tags, expected_count in [
-                ( ['t1NOTt2'], [], 0 ),
-                ( ['t1NOTt2'], ['t1'], 1 ),
-                ( ['t1NOTt2'], ['t1','t2'], 0 ),
-                ( ['t1NOTt2'], ['t3'], 0 ),
-                ( ['t1NOTt2'], ['t3','t2'], 0 ),
-                ( ['t*NOTt2'], ['t1'], 1 ),
-                ( ['t*NOTt2'], ['t'], 1 ),
-                ( ['t*NOTt2'], ['TEE'], 1 ),
-                ( ['t*NOTt2'], ['T2'], 0 ),
-                ( ['T*NOTT?'], ['t'], 1 ),
-                ( ['T*NOTT?'], ['tt'], 0 ),
-                ( ['T*NOTT?'], ['ttt'], 1 ),
-                ( ['T*NOTT?'], ['tt','t'], 0 ),
-                ( ['T*NOTT?'], ['ttt','something'], 1 ),
-                ( ['tNOTs*NOTr'], ['t'], 1 ),
-                ( ['tNOTs*NOTr'], ['t','s'], 0 ),
-                ( ['tNOTs*NOTr'], ['R','T'], 0 ),
-                ( ['tNOTs*NOTr'], ['R','T','s'], 0 ),
-                ]:
+                (['t1NOTt2'], [], 0),
+                (['t1NOTt2'], ['t1'], 1),
+                (['t1NOTt2'], ['t1','t2'], 0),
+                (['t1NOTt2'], ['t3'], 0),
+                (['t1NOTt2'], ['t3','t2'], 0),
+                (['t*NOTt2'], ['t1'], 1),
+                (['t*NOTt2'], ['t'], 1),
+                (['t*NOTt2'], ['TEE'], 1),
+                (['t*NOTt2'], ['T2'], 0),
+                (['T*NOTT?'], ['t'], 1),
+                (['T*NOTT?'], ['tt'], 0),
+                (['T*NOTT?'], ['ttt'], 1),
+                (['T*NOTT?'], ['tt','t'], 0),
+                (['T*NOTT?'], ['ttt','something'], 1),
+                (['tNOTs*NOTr'], ['t'], 1),
+                (['tNOTs*NOTr'], ['t','s'], 0),
+                (['tNOTs*NOTr'], ['R','T'], 0),
+                (['tNOTs*NOTr'], ['R','T','s'], 0),
+               ]:
self._test_combined_statistics(comb_tags, test_tags, expected_count)

     def test_combine(self):
-        # This test is more like an acceptance test than a unit test and
+        # This test is more like an acceptance test than a unit test and
         # is doing too much...
         for comb_tags, comb_matches, tests_tags, crit_tags in [
-                ( ['t1&t2'], [1], [['t1','t2','t3'],['t1','t3']], [] ),
- ( ['1&2&3'], [2], [['1','2','3'],['1','2','3','4']], ['1','2'] ), - ( ['1&2','1&3'], [1,2], [['1','2','3'],['1','3'],['1']], ['1'] ),
-                ( ['t*'], [3], [['t1','x','y'],['tee','z'],['t']], ['x'] ),
- ( ['t?&s'], [2], [['t1','s'],['tt','s','u'],['tee','s'],['s']], [] ), - ( ['t*&s','*'], [2,3], [['s','t','u'],['tee','s'],[],['x']], [] ),
-                ( ['tNOTs'], [1], [['t','u'],['t','s']], [] ),
-                ( ['tNOTs','t&s','tNOTsNOTu', 't&sNOTu'], [3,2,2,1],
- [['t','u'],['t','s'],['s','t','u'],['t'],['t','v']], ['t'] ),
-                ( ['nonex'], [0], [['t1'],['t1,t2'],[]], [] )
-                ]:
+                (['t1&t2'], [1], [['t1','t2','t3'],['t1','t3']], []),
+ (['1&2&3'], [2], [['1','2','3'],['1','2','3','4']], ['1','2']), + (['1&2','1&3'], [1,2], [['1','2','3'],['1','3'],['1']], ['1']),
+                (['t*'], [3], [['t1','x','y'],['tee','z'],['t']], ['x']),
+ (['t?&s'], [2], [['t1','s'],['tt','s','u'],['tee','s'],['s']], []), + (['t*&s','*'], [2,3], [['s','t','u'],['tee','s'],[],['x']], []),
+                (['tNOTs'], [1], [['t','u'],['t','s']], []),
+                (['tNOTs','t&s','tNOTsNOTu', 't&sNOTu'], [3,2,2,1],
+ [['t','u'],['t','s'],['s','t','u'],['t'],['t','v']], ['t']),
+                (['nonex'], [0], [['t1'],['t1,t2'],[]], [])
+               ]:
             # 1) Create tag stats
             tagstats = TagStatistics([], [], comb_tags)
             all_tags = []
@@ -274,9 +271,7 @@
tagstats.add_test(TestMock('PASS', tags), _Critical(crit_tags))
                 all_tags.extend(tags)
             # 2) Actual values
-            stats = tagstats.stats.values()
-            stats.sort()  # sorts crit first, then comb, then non-crit
-            names = [ stat.name for stat in stats ]
+            names = [stat.name for stat in sorted(tagstats.stats.values())]
             # 3) Expected values
             exp_crit = []; exp_noncr = []; exp_comb = []
             for tag in utils.normalize_tags(all_tags):
@@ -301,16 +296,14 @@
         suite.critical_tags = ['smoke']
         statistics = Statistics(suite, -1, ['t*','smoke'], ['t3'],
                                 ['t1&t2','t?&smoke','t1NOTt2','none&t1'])
-        #TODO: Demeter
         stats = statistics.tags.stats.values()
         stats.sort()
-        expected = [ ('smoke', 4), ('none & t1', 0), ('t1 & t2', 3),
- ('t1 NOT t2', 2), ('t? & smoke', 4), ('t1', 5), ('t2', 3) ]
-        names = [ stat.name for stat in stats ]
-        exp_names = [ name for name, count in expected ]
+        expected = [('smoke', 4), ('none & t1', 0), ('t1 & t2', 3),
+ ('t1 NOT t2', 2), ('t? & smoke', 4), ('t1', 5), ('t2', 3)]
+        names = [stat.name for stat in stats]
+        exp_names = [name for name, count in expected]
         assert_equals(names, exp_names)
         for name, count in expected:
-            #TODO: Demeter
assert_equals(len(statistics.tags.stats[name].tests), count, name)


@@ -319,9 +312,10 @@
     def test_valid_string_is_parsed_correctly(self):
         for arg, exp in [(('Tag', 'bar/foo.html', 'foobar'),
                           ('^Tag$', 'bar/foo.html', 'foobar')),
- (('hello', 'gopher://hello.world:8090/hello.html', 'Hello World'), - ('^hello$', 'gopher://hello.world:8090/hello.html', 'Hello World'))
-                         ]:
+                         (('hello', 'gopher://hello.world:8090/hello.html',
+                           'Hello World'),
+ ('^hello$', 'gopher://hello.world:8090/hello.html',
+                           'Hello World'))]:
             link = TagStatLink(*arg)
             assert_equal(exp[0], link._regexp.pattern)
             assert_equal(exp[1], link._link)
@@ -331,23 +325,22 @@
         for arg, exp_pattern in [('*', '^(.*)$'), ('f*r', '^f(.*)r$'),
                                  ('*a*', '^(.*)a(.*)$'),  ('?', '^(.)$'),
('??', '^(..)$'), ('f???ar', '^f(...)ar$'),
-                                 ('F*B?R*?', '^F(.*)B(.)R(.*)(.)$')
-                                 ]:
+                                 ('F*B?R*?', '^F(.*)B(.)R(.*)(.)$')]:
             link = TagStatLink(arg, 'some_url', 'some_title')
             assert_equal(exp_pattern, link._regexp.pattern)
-
+
     def test_underscores_in_title_are_converted_to_spaces(self):
         link = TagStatLink('', '', 'my_name')
         assert_equal(link._title, 'my name')
-
+
     def test_get_link_returns_correct_link_when_matches(self):
         for arg, exp in [(('smoke', 'http://tobacco.com', 'Lung_cancer'),
                           ('http://tobacco.com', 'Lung cancer')),
                          (('tag', 'ftp://foo:809/bar.zap', 'Foo_in a Bar'),
-                          ('ftp://foo:809/bar.zap', 'Foo in a Bar')) ]:
+                          ('ftp://foo:809/bar.zap', 'Foo in a Bar'))]:
             link = TagStatLink(*arg)
             assert_equals(exp, link.get_link(arg[0]))
-
+
     def test_get_link_returns_none_when_no_match(self):
         link = TagStatLink('smoke', 'http://tobacco.com', 'Lung cancer')
         for tag in ['foo', 'b a r', 's moke']:
@@ -369,36 +362,35 @@
         link = TagStatLink('f?o*r', 'http://foo/bar.html', 'FooBar')
         for tag in ['foobar', 'foor', 'f_ofoobarfoobar', 'fOoBAr']:
assert_equal(link.get_link(tag), ('http://foo/bar.html', 'FooBar'))
-
+
     def test_pattern_substitution_with_one_match(self):
         link = TagStatLink('tag-*', 'http://tracker/?id=%1', 'Tracker')
         for id in ['1', '23', '456']:
             exp = ('http://tracker/?id=%s' % id, 'Tracker')
             assert_equal(exp, link.get_link('tag-%s' % id))
-
+
     def test_pattern_substitution_with_multiple_matches(self):
         link = TagStatLink('?-*', 'http://tracker/?id=%1-%2', 'Tracker')
         for id1, id2 in [('1', '2'), ('3', '45'), ('f', 'bar')]:
             exp = ('http://tracker/?id=%s-%s' % (id1, id2), 'Tracker')
             assert_equal(exp, link.get_link('%s-%s' % (id1, id2)))
-
+
     def test_pattern_substitution_with_multiple_substitutions(self):
         link = TagStatLink('?-?-*', '%3-%3-%1-%2-%3', 'Tracker')
assert_equal(link.get_link('a-b-XXX'), ('XXX-XXX-a-b-XXX', 'Tracker'))
-
+
     def test_matches_are_ignored_in_pattern_substitution(self):
         link = TagStatLink('?-*-*-?', '%4-%2-%2-%4', 'Tracker')
assert_equal(link.get_link('A-XXX-ABC-B'), ('B-XXX-XXX-B', 'Tracker'))
-
+

 class TestTagStatLinks(unittest.TestCase):
-
+
     def test_tag_stat_links_with_valid_tags(self):
-        values = [('1', '2', '3'), ('tag', 'foo.html', 'bar')]
+        values = [('1', '2', '3'), ('tag', 'foo.html', 'bar')]
         tag_stat_links = TagStatInfo([], values)
         assert_equal(len(tag_stat_links._links), 2)
-
-
-
+
+
 if __name__ == "__main__":
     unittest.main()

==============================================================================
Revision: ddcf407753f3
Author:   Pekka Klärck
Date:     Mon Jun 20 09:06:50 2011
Log: get default value of tagstatcombine title only in stats, not in settings
http://code.google.com/p/robotframework/source/detail?r=ddcf407753f3

Modified:
 /src/robot/common/statistics.py
 /src/robot/conf/settings.py

=======================================
--- /src/robot/common/statistics.py     Mon Jun 20 07:37:15 2011
+++ /src/robot/common/statistics.py     Mon Jun 20 09:06:50 2011
@@ -187,6 +187,7 @@

     def _add_combined_statistics(self, test):
         for pattern, name in self._combine:
+            name = name or pattern
             if name not in self.stats:
                 self.stats[name] = TagStat(name, self._get_doc(name),
                                            self._get_links(name),
=======================================
--- /src/robot/conf/settings.py Mon Jun 20 07:28:03 2011
+++ /src/robot/conf/settings.py Mon Jun 20 09:06:50 2011
@@ -164,7 +164,7 @@
             value = value.replace(replwhat, replwith)
         if ':' in value:
             return value.rsplit(':', 1)
-        return value, value
+        return value, ''

     def _process_tag_stat_link(self, value):
         tokens = value.split(':')

==============================================================================
Revision: 3d9804ff8930
Author:   Pekka Klärck
Date:     Mon Jun 20 09:07:26 2011
Log: fixed statistics tests after refactoring and removed dead code from mocks
http://code.google.com/p/robotframework/source/detail?r=3d9804ff8930

Modified:
 /utest/common/test_statistics.py

=======================================
--- /utest/common/test_statistics.py    Mon Jun 20 08:41:50 2011
+++ /utest/common/test_statistics.py    Mon Jun 20 09:07:26 2011
@@ -12,21 +12,13 @@

     def __init__(self, name='My Name', crit_tags=None):
         self.name = name
-        self.mediumname = self.get_medium_name()
-        self.longname = self.get_long_name()
         self.critical = _Critical(crit_tags)
         self.suites = []
         self.tests = []
         self.message = ''

-    def get_long_name(self, separator="."):
-        if separator is None:
-            return self.name.split('.')
-        return self.name.replace('.', separator)
-
-    def get_medium_name(self, separator='.'):
-        parts = self.name.split('.')
-        return '.'.join([i[0].lower() for i in parts[:-1]] + [parts[-1]])
+    def get_long_name(self):
+        return self.name

     def add_suite(self, name):
         suite = SuiteMock(name, self.critical.tags)
@@ -191,67 +183,66 @@
     def test_combine_with_name(self):
         for comb_tags, expected_name in [
                 ([], '' ),
-                (['t1&t2:my name'], 'my name'),
-                (['t1NOTt3:Others'], 'Others'),
-                (['1:2&2:3:nAme'], 'nAme'),
-                (['3*'], '3*' ),
-                (['4NOT5:Some new name'], 'Some new name')
+                ([('t1&t2', 'my name')], 'my name'),
+                ([('t1NOTt3', 'Others')], 'Others'),
+                ([('1:2&2:3', 'nAme')], 'nAme'),
+                ([('3*', '')], '3*' ),
+                ([('4NOT5', 'Some new name')], 'Some new name')
                ]:
-            stats = TagStatistics(tag_stat_combine=comb_tags)
+            stats = TagStatistics(combine=comb_tags)
             test = TestMock()
-            stats._add_tagstatcombine_statistics(test)
+            stats._add_combined_statistics(test)
             assert_equals(len(stats.stats), expected_name != '')
             if expected_name:
assert_equals(stats.stats[expected_name].name, expected_name)

     def test_is_combined_with_and_statements(self):
         for comb_tags, test_tags, expected_count in [
-                (['t1'], ['t1'], 1),
-                (['t1'], ['t2'], 0),
-                (['t1&t2'], ['t1'], 0),
-                (['t1&t2'], ['t1','t2'], 1),
-                (['t1&t2'], ['T1','t 2','t3'], 1),
-                (['t*'], ['s','t','u'], 1),
-                (['t*'], ['s','tee','t'], 1),
-                (['t*&s'], ['s','tee','t'], 1),
-                (['t*&s&non'], ['s','tee','t'], 0)
+                ('t1', ['t1'], 1),
+                ('t1', ['t2'], 0),
+                ('t1&t2', ['t1'], 0),
+                ('t1&t2', ['t1','t2'], 1),
+                ('t1&t2', ['T1','t 2','t3'], 1),
+                ('t*', ['s','t','u'], 1),
+                ('t*', ['s','tee','t'], 1),
+                ('t*&s', ['s','tee','t'], 1),
+                ('t*&s&non', ['s','tee','t'], 0)
                ]:
self._test_combined_statistics(comb_tags, test_tags, expected_count)

def _test_combined_statistics(self, comb_tags, test_tags, expected_count): - stats = TagStatistics(tag_stat_combine=['%s:name' % rule for rule in comb_tags])
+            stats = TagStatistics(combine=[(comb_tags, 'name')])
             test = TestMock(tags=test_tags)
-            stats._add_tagstatcombine_statistics(test)
+            stats._add_combined_statistics(test)
             assert_equals(len(stats.stats['Name'].tests), expected_count,
                           'comb: %s, test: %s' % (comb_tags, test_tags))

     def test_is_combined_with_not_statements(self):
         stats = TagStatistics()
         for comb_tags, test_tags, expected_count in [
-                (['t1NOTt2'], [], 0),
-                (['t1NOTt2'], ['t1'], 1),
-                (['t1NOTt2'], ['t1','t2'], 0),
-                (['t1NOTt2'], ['t3'], 0),
-                (['t1NOTt2'], ['t3','t2'], 0),
-                (['t*NOTt2'], ['t1'], 1),
-                (['t*NOTt2'], ['t'], 1),
-                (['t*NOTt2'], ['TEE'], 1),
-                (['t*NOTt2'], ['T2'], 0),
-                (['T*NOTT?'], ['t'], 1),
-                (['T*NOTT?'], ['tt'], 0),
-                (['T*NOTT?'], ['ttt'], 1),
-                (['T*NOTT?'], ['tt','t'], 0),
-                (['T*NOTT?'], ['ttt','something'], 1),
-                (['tNOTs*NOTr'], ['t'], 1),
-                (['tNOTs*NOTr'], ['t','s'], 0),
-                (['tNOTs*NOTr'], ['R','T'], 0),
-                (['tNOTs*NOTr'], ['R','T','s'], 0),
+                ('t1NOTt2', [], 0),
+                ('t1NOTt2', ['t1'], 1),
+                ('t1NOTt2', ['t1','t2'], 0),
+                ('t1NOTt2', ['t3'], 0),
+                ('t1NOTt2', ['t3','t2'], 0),
+                ('t*NOTt2', ['t1'], 1),
+                ('t*NOTt2', ['t'], 1),
+                ('t*NOTt2', ['TEE'], 1),
+                ('t*NOTt2', ['T2'], 0),
+                ('T*NOTT?', ['t'], 1),
+                ('T*NOTT?', ['tt'], 0),
+                ('T*NOTT?', ['ttt'], 1),
+                ('T*NOTT?', ['tt','t'], 0),
+                ('T*NOTT?', ['ttt','something'], 1),
+                ('tNOTs*NOTr', ['t'], 1),
+                ('tNOTs*NOTr', ['t','s'], 0),
+                ('tNOTs*NOTr', ['R','T'], 0),
+                ('tNOTs*NOTr', ['R','T','s'], 0),
                ]:
self._test_combined_statistics(comb_tags, test_tags, expected_count)

     def test_combine(self):
-        # This test is more like an acceptance test than a unit test and
-        # is doing too much...
+        # This is more like an acceptance test than a unit test ...
         for comb_tags, comb_matches, tests_tags, crit_tags in [
                 (['t1&t2'], [1], [['t1','t2','t3'],['t1','t3']], []),
(['1&2&3'], [2], [['1','2','3'],['1','2','3','4']], ['1','2']),
@@ -265,7 +256,7 @@
                 (['nonex'], [0], [['t1'],['t1,t2'],[]], [])
                ]:
             # 1) Create tag stats
-            tagstats = TagStatistics([], [], comb_tags)
+            tagstats = TagStatistics(combine=[(t, '') for t in comb_tags])
             all_tags = []
             for tags in tests_tags:
tagstats.add_test(TestMock('PASS', tags), _Critical(crit_tags))
@@ -280,14 +271,12 @@
                 else:
                     exp_noncr.append(tag)
             for comb, count in zip(comb_tags, comb_matches):
-                name = comb.replace('&',' & ').replace('NOT',' NOT ')
-                exp_comb.append(name)
+                exp_comb.append(comb)
                 try:
-                    assert_equals(len(tagstats.stats[name].tests), count)
+                    assert_equals(len(tagstats.stats[comb].tests), count)
                 except KeyError:
-                    fail("No key %s. Stats: %s" % (name, tagstats.stats))
-            exp_comb.sort()
-            exp_names = exp_crit + exp_comb + exp_noncr
+                    fail("No key %s. Stats: %s" % (comb, tagstats.stats))
+            exp_names = exp_crit + sorted(exp_comb) + exp_noncr
             # 4) Verify names (match counts were already verified)
             assert_equals(names, exp_names)

@@ -295,11 +284,11 @@
         suite = generate_default_suite()
         suite.critical_tags = ['smoke']
         statistics = Statistics(suite, -1, ['t*','smoke'], ['t3'],
-                                ['t1&t2','t?&smoke','t1NOTt2','none&t1'])
-        stats = statistics.tags.stats.values()
-        stats.sort()
-        expected = [('smoke', 4), ('none & t1', 0), ('t1 & t2', 3),
- ('t1 NOT t2', 2), ('t? & smoke', 4), ('t1', 5), ('t2', 3)]
+                                [('t1 & t2', ''), ('t? & smoke', ''),
+ ('t1 NOT t2', ''), ('none & t1', 'a title')])
+        stats = sorted(statistics.tags.stats.values())
+        expected = [('smoke', 4), ('a title', 0), ('t1 & t2', 3),
+ ('t1 NOT t2', 2), ('t? & smoke', 4), ('t1', 5), ('t2', 3)]
         names = [stat.name for stat in stats]
         exp_names = [name for name, count in expected]
         assert_equals(names, exp_names)

==============================================================================
Revision: ccc4fe10ddd4
Author:   Pekka Klärck
Date:     Mon Jun 20 09:24:47 2011
Log:      no douple spaces around AND
http://code.google.com/p/robotframework/source/detail?r=ccc4fe10ddd4

Modified:
 /src/robot/conf/settings.py

=======================================
--- /src/robot/conf/settings.py Mon Jun 20 09:06:50 2011
+++ /src/robot/conf/settings.py Mon Jun 20 09:24:47 2011
@@ -159,7 +159,7 @@
         return value, ''

     def _process_tag_stat_combine(self, value):
-        for replwhat, replwith in [('_', ' '), ('AND', ' & '),
+        for replwhat, replwith in [('_', ' '), ('AND', '&'),
                                    ('&', ' & '), ('NOT', ' NOT ')]:
             value = value.replace(replwhat, replwith)
         if ':' in value:

==============================================================================
Revision: bd9af7a1a75f
Author:   Pekka Klärck
Date:     Mon Jun 20 09:25:25 2011
Log:      fixed tag doc tests with rebot and added one more test
http://code.google.com/p/robotframework/source/detail?r=bd9af7a1a75f

Modified:
 /atest/robot/tags/tag_doc_with_rebot.txt

=======================================
--- /atest/robot/tags/tag_doc_with_rebot.txt    Mon Jun 13 23:52:45 2011
+++ /atest/robot/tags/tag_doc_with_rebot.txt    Mon Jun 20 09:25:25 2011
@@ -62,12 +62,16 @@
Format In Report Details Should Be Correct d2 Doc for many tags More doc

 Tag Doc With Multiple Matches In Output Statistics
- Format In Output Statistics Should Be Correct d2 Doc for many tags More doc + Format In Output Statistics Should Be Correct d2 Doc for many tags & More doc
+
+Tag Doc For Combined Statistics
+    Format In Output Statistics Should Be Correct  DX  Doc for many tags
+

 *** Keywords ***
 Run Tests And Read Outputs
     Run Tests Without Processing Output  ${EMPTY}  misc/normal.html
- Run Rebot --log log.html --report report.html --tagdoc f1:Some_documentation --tagdoc t1:http://some.url_*bold* --tagdoc d?:Doc_for_many_tags --tagdoc D2:More_doc ${OUT_FILE} + Run Rebot --log log.html --report report.html --tagdoc f1:Some_documentation --tagdoc t1:http://some.url_*bold* --tagdoc d?:Doc_for_many_tags --tagdoc D2:More_doc --tagstatcombine d*:DX ${OUT_FILE}
     ${LOG} =  Get File  ${OUT_DIR}/log.html
     ${REPORT} =  Get File  ${OUT_DIR}/report.html
     ${OUTPUT} =  Get File  ${OUT_FILE}

==============================================================================
Revision: b4f63c715803
Author:   Pekka Klärck
Date:     Mon Jun 20 09:45:44 2011
Log:      fixed escaping doc and metadata from cli
http://code.google.com/p/robotframework/source/detail?r=b4f63c715803

Modified:
 /atest/robot/cli/rebot/suite_name_doc_and_metadata.txt
 /atest/robot/cli/runner/suite_name_doc_and_metadata.txt
 /src/robot/conf/settings.py

=======================================
--- /atest/robot/cli/rebot/suite_name_doc_and_metadata.txt Mon Sep 20 14:47:33 2010 +++ /atest/robot/cli/rebot/suite_name_doc_and_metadata.txt Mon Jun 20 09:45:44 2011
@@ -17,11 +17,11 @@
 Overriding Name, Doc & Metadata And Escaping
[Documentation] Overriding name, doc and metadata. Also testing escaping values. Tests are run together to have less Rebot runs with same input i.e. to have faster execution.
     ${bs} =  Set Variable If  __import__('os').name == 'nt'  \\  \\\\
- Run Rebot -N this_is_overridden_next --name my_COOL_NameEXEX --doc Even_cooooler_docEXQU --metadata something:New --metadata two_parts:three_parts_here -M path:c:${bs}temp${bs}new.txt -M esc:STQUDOAMHAEXEX --escape star:ST -E quest:QU -E dollar:DO -E amp:AM -E hash:HA -E exclam:EX ${MYINPUT} + Run Rebot -N this_is_overridden_next --name my_COOL_NameEXEX --doc Even_${bs}cooooler${bs}_docEXQU --metadata something:New --metadata two_parts:three_parts_here -M path:c:${bs}temp${bs}new.txt -M esc:STQUDOAMHAEXEX --escape star:ST -E quest:QU -E dollar:DO -E amp:AM -E hash:HA -E exclam:EX ${MYINPUT}
     Check Names  ${SUITE}  my COOL Name!!
     Check Names  ${SUITE.tests[0]}  First One  my COOL Name!!.
     Check Names  ${SUITE.tests[1]}  Second One  my COOL Name!!.
-    Should Be Equal  ${SUITE.doc}  Even cooooler doc!?
+    Should Be Equal  ${SUITE.doc}  Even \\cooooler\\ doc!?
     Should Be Equal  ${SUITE.metadata['Something']}  New
     Should Be Equal  ${SUITE.metadata['two parts']}  three parts here
     Should Be Equal  ${SUITE.metadata['path']}  c:\\temp\\new.txt
=======================================
--- /atest/robot/cli/runner/suite_name_doc_and_metadata.txt Mon Sep 20 14:47:33 2010 +++ /atest/robot/cli/runner/suite_name_doc_and_metadata.txt Mon Jun 20 09:45:44 2011
@@ -15,15 +15,15 @@

 Overriding Name, Doc & Metadata And Escaping
     ${bs} =  Set Variable If  __import__('os').name == 'nt'  \\  \\\\
- Run Tests -l log.html -N this_is_overridden_next --name my_COOL_Name.EXEX. --doc Even_cooooler_docEXQU --metadata something:new --metadata Two_Parts:three_part_VALUE -M path:c:${bs}temp${bs}new.txt -M esc:STQUDOAMHAEXEX --escape star:ST -E quest:QU -E dollar:DO -E amp:AM -E hash:HA -E exclam:EX ${TESTFILE} + Run Tests -l log.html -N this_is_overridden_next --name my_COOL_Name.EXEX. --doc Even_${bs}cooooler${bs}_docEXQU --metadata something:new --metadata Two_Parts:three_part_VALUE -M path:c:${bs}temp${bs}new.txt -M esc:STQUDOAMHAEXEX --escape star:ST -E quest:QU -E dollar:DO -E amp:AM -E hash:HA -E exclam:EX ${TESTFILE}
     Check Names  ${SUITE}  my COOL Name.!!.
     Check Names  ${SUITE.tests[0]}  First One  my COOL Name.!!..
     Check Names  ${SUITE.tests[1]}  Second One  my COOL Name.!!..
-    Should Be Equal  ${SUITE.doc}  Even cooooler doc!?
+    Should Be Equal  ${SUITE.doc}  Even \\cooooler\\ doc!?
     Should Be Equal  ${SUITE.metadata['Something']}  new
     Should Be Equal  ${SUITE.metadata['Two Parts']}  three part VALUE
     Should Be Equal  ${SUITE.metadata['path']}  c:\\temp\\new.txt
     Should Be Equal  ${SUITE.metadata['esc']}  *?$&#!!
     Check File Contains  ${OUTDIR}/log.html  Something
     Check File Does Not Contain  ${OUTDIR}/log.html  something
-
+
=======================================
--- /src/robot/conf/settings.py Mon Jun 20 09:24:47 2011
+++ /src/robot/conf/settings.py Mon Jun 20 09:45:44 2011
@@ -78,8 +78,10 @@
         if value in [None, []]:
             return value
if name in ['Name', 'Doc', 'LogTitle', 'ReportTitle', 'SummaryTitle']:
+            if name == 'Doc': value = self._escape(value)
             return value.replace('_', ' ')
         if name in ['Metadata', 'TagDoc']:
+            if name == 'Metadata': value = [self._escape(v) for v in value]
             return [self._process_metadata_or_tagdoc(v) for v in value]
         if name in ['Include', 'Exclude']:
             return [v.replace('AND', '&').replace('_', ' ') for v in value]
@@ -237,6 +239,9 @@
             return True
         return self._opts['Output'] == 'NONE' and type_ != 'DebugFile'

+    def _escape(self, value):
+        return utils.escape(value)
+

 class RebotSettings(_BaseSettings):
     _extra_cli_opts = {'Output'         : ('output', 'NONE'),
@@ -247,3 +252,6 @@

     def _outputfile_disabled(self, type_, name):
         return name == 'NONE'
+
+    def _escape(self, value):
+        return value

Reply via email to