2 new revisions:

Revision: 1a5cde4d8449
Branch:   default
Author:   Pekka Klärck
Date:     Fri Jan 24 14:36:55 2014 UTC
Log: Consistent and slightly enhanced handling of tag patterns with --inclu...
http://code.google.com/p/robotframework/source/detail?r=1a5cde4d8449

Revision: 7918c89f29bf
Branch:   default
Author:   Pekka Klärck
Date:     Fri Jan 24 14:37:01 2014 UTC
Log:      Automated merge with https://code.google.com/p/robotframework/
http://code.google.com/p/robotframework/source/detail?r=7918c89f29bf

==============================================================================
Revision: 1a5cde4d8449
Branch:   default
Author:   Pekka Klärck
Date:     Fri Jan 24 14:36:55 2014 UTC
Log: Consistent and slightly enhanced handling of tag patterns with --include, --exclude and --tagstatcombine
http://code.google.com/p/robotframework/source/detail?r=1a5cde4d8449

Modified:
 /atest/robot/output/statistics.txt
 /atest/robot/output/statistics_with_rebot.txt
 /atest/robot/tags/include_and_exclude.txt
 /atest/robot/tags/include_and_exclude_with_rebot.txt
 /src/robot/conf/settings.py
 /src/robot/model/tags.py

=======================================
--- /atest/robot/output/statistics.txt  Fri Jan 24 10:45:16 2014 UTC
+++ /atest/robot/output/statistics.txt  Fri Jan 24 14:36:55 2014 UTC
@@ -20,19 +20,29 @@

 Tag statistics should be Correct
     ${stats} =    Get Element    ${OUTFILE}    statistics/tag
- Tag Node Should Be Correct ${stats[0]} t1 5 1 info=critical links=my title:http://url.to:::title:url - Tag Node Should Be Correct ${stats[2]} D1 OR sub3 OR t2 4 0 info=combined - Tag Node Should Be Correct ${stats[3]} f1 AND t1 5 1 info=combined - Tag Node Should Be Correct ${stats[4]} F1 NOT _T1 4 0 info=combined - Tag Node Should Be Correct ${stats[5]} d1 1 0 links=title:url
-    Tag Node Should Be Correct    ${stats[6]}    d2    1    0
- Tag Node Should Be Correct ${stats[7]} f1 9 1 doc=this is tagdoc links=title:url
-    Tag Node Should Be Correct    ${stats[8]}    sub3    2    0
-    Tag Node Should Be Correct    ${stats[9]}    XXX    10    1
+    Tag Node Should Be Correct    ${stats[0]}    t1
+ ... 5 1 info=critical links=my title:http://url.to:::title:url + Tag Node Should Be Correct ${stats[2]} D1 OR sub3 OR t2 OR or and not + ... 4 0 info=combined combined=D1 OR sub3 OR t2 OR or and not
+    Tag Node Should Be Correct    ${stats[3]}    f1 AND t1
+    ...    5    1    info=combined    combined=f1 AND t1
+    Tag Node Should Be Correct    ${stats[4]}    F1 NOT T1
+    ...    4    0    info=combined    combined=F1 NOT T1
+    Tag Node Should Be Correct    ${stats[5]}    d1
+    ...    1    0    links=title:url
+    Tag Node Should Be Correct    ${stats[6]}    d2
+    ...    1    0
+    Tag Node Should Be Correct    ${stats[7]}    f1
+    ...    9    1    doc=this is tagdoc    links=title:url
+    Tag Node Should Be Correct    ${stats[8]}    sub3
+    ...    2    0
+    Tag Node Should Be Correct    ${stats[9]}    XXX
+    ...    10    1

 Combined Tag Statistics Name Can Be Given
     ${stats} =    Get Element    ${OUTFILE}    statistics/tag
- Tag Node Should Be Correct ${stats[1]} combined tag with new name 1 0 combined + Tag Node Should Be Correct ${stats[1]} Combined tag with new name AND-OR-NOT
+    ...    1    0    info=combined    combined=d1 AND d2

 Suite statistics should be Correct
     ${stats} =    Get Element    ${OUTFILE}    statistics/suite
@@ -52,8 +62,8 @@
     ...    --tagstatlink t*:http://url.to:my_title
     ...    --tagstatlink ?1:url:title
     ...    --tagstatcombine f1ANDt1
-    ...    --tagstatcombine D1ORsub3ORt2
-    ...    --tagstatcombine d1ANDd2:combined_tag_with_new_name
+    ...    --tagstatcombine D1ORsub3ORt2_OR_or_and_not
+    ...    --tagstatcombine d1ANDd2:Combined_tag_with_new_name_AND-OR-NOT
     ...    --suitestatlevel 2
     ...    --tagstatexclude t2
     ...    --TagStatComb F1NOT_T1
@@ -67,11 +77,12 @@
     Should be equal    ${node.attrib['fail']}    ${fail}

 Tag Node Should Be Correct
- [Arguments] ${node} ${name} ${pass} ${fail} ${info}= ${doc}= ${links}= + [Arguments] ${node} ${name} ${pass} ${fail} ${info}= ${doc}= ${links}= ${combined}=
     Node Should Be Correct    ${node}    ${name}    ${pass}    ${fail}
     Should be equal    ${node.attrib['info']}    ${info}
     Should be equal    ${node.attrib['doc']}     ${doc}
     Should be equal    ${node.attrib['links']}    ${links}
+    Should be equal    ${node.attrib['combined']}    ${combined}

 Suite Node Should Be Correct
     [Arguments]    ${node}    ${name}    ${pass}    ${fail}
=======================================
--- /atest/robot/output/statistics_with_rebot.txt Thu Jan 23 11:33:15 2014 UTC +++ /atest/robot/output/statistics_with_rebot.txt Fri Jan 24 14:36:55 2014 UTC
@@ -19,14 +19,22 @@

 Tag statistics should be Correct
     ${stats} =    Get Element    ${OUTFILE}    statistics/tag
-    Tag Node Should Be Correct    ${stats[0]}    t1    5    1    critical
- Tag Node Should Be Correct ${stats[1]} d1 AND d2 1 0 combined - Tag Node Should Be Correct ${stats[2]} F1 NOT T_1 4 0 info=combined
-    Tag Node Should Be Correct    ${stats[3]}    d1    1    0
-    Tag Node Should Be Correct    ${stats[4]}    d2    1    0
-    Tag Node Should Be Correct    ${stats[5]}    f1    9    1
-    Tag Node Should Be Correct    ${stats[6]}    sub3    2    0
-    Tag Node Should Be Correct    ${stats[7]}    XxX    10    1
+    Tag Node Should Be Correct    ${stats[0]}    t1
+    ...    5    1    critical
+    Tag Node Should Be Correct    ${stats[1]}    Custom title AND-OR-NOT
+    ...    1    0    info=combined    combined=d1 AND d2
+    Tag Node Should Be Correct    ${stats[2]}    F1 NOT T 1
+    ...    4    0    info=combined    combined=F1 NOT T 1
+    Tag Node Should Be Correct    ${stats[3]}    d1
+    ...    1    0
+    Tag Node Should Be Correct    ${stats[4]}    d2
+    ...    1    0
+    Tag Node Should Be Correct    ${stats[5]}    f1
+    ...    9    1
+    Tag Node Should Be Correct    ${stats[6]}    sub3
+    ...    2    0
+    Tag Node Should Be Correct    ${stats[7]}    XxX
+    ...    10    1

 Suite statistics should be Correct
     ${stats} =    Get Element    ${OUTFILE}    statistics/suite
@@ -44,7 +52,7 @@
     Move File    ${OUTFILE}    ${OUTDIR}/statistics.xml
     ${options} =    Catenate
     ...    --critical t1
-    ...    --tagstatcombine d1ANDd2
+    ...    --tagstatcombine d1_AND_d2:Custom_title_AND-OR-NOT
     ...    --suitestatlevel 2
     ...    --tagstatexclude t2
     ...    --TagStatComb F1NOTT_1
@@ -58,6 +66,7 @@
     Element Attribute Should Be      ${node}      fail      ${fail}

 Tag Node Should Be Correct
-    [Arguments]    ${node}    ${name}    ${pass}    ${fail}    ${info}=
+ [Arguments] ${node} ${name} ${pass} ${fail} ${info}= ${combined}=
     Node Should Be Correct    ${node}    ${name}    ${pass}    ${fail}
     Element Attribute Should Be      ${node}      info      ${info}
+    Element Attribute Should Be      ${node}      combined      ${combined}
=======================================
--- /atest/robot/tags/include_and_exclude.txt   Fri Jan 24 10:45:16 2014 UTC
+++ /atest/robot/tags/include_and_exclude.txt   Fri Jan 24 14:36:55 2014 UTC
@@ -90,8 +90,8 @@
     [Template]    Run And Check Error
     --include nonex    tag 'nonex'
     --include nonex -i nonex2    tags 'nonex' or 'nonex2'
-    --include incl1ANDnonex    tag 'incl1&nonex'
-    --include nonexORnonex2    tag 'nonexORnonex2'
+    --include incl1AMPnonex    tag 'incl1 AND nonex'
+    --include nonex_OR_nonex_2    tag 'nonex OR nonex 2'

 Non Matching Exclude
     --exclude nonexisting -e nonex2 -e nonex3    @{ALL}
=======================================
--- /atest/robot/tags/include_and_exclude_with_rebot.txt Fri Jan 24 10:45:16 2014 UTC +++ /atest/robot/tags/include_and_exclude_with_rebot.txt Fri Jan 24 14:36:55 2014 UTC
@@ -97,8 +97,8 @@
     [Template]    Run And Check Error
     --include nonex    tag 'nonex'
     --include nonex -i nonex2    tags 'nonex' or 'nonex2'
-    --include incl1ANDnonex    tag 'incl1&nonex'
-    --include nonexORnonex2    tag 'nonexORnonex2'
+    --include incl1AMPnonex    tag 'incl1 AND nonex'
+    --include nonex_OR_nonex_2    tag 'nonex OR nonex 2'

 Non Matching Exclude
     --exclude nonexisting -e nonex2 -e nonex3    @{ALL}
=======================================
--- /src/robot/conf/settings.py Fri Jan 24 10:45:16 2014 UTC
+++ /src/robot/conf/settings.py Fri Jan 24 14:36:55 2014 UTC
@@ -98,7 +98,7 @@
                 value = [self._escape_as_data(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]
+            return [self._format_tag_patterns(v) for v in value]
if name in self._output_opts and (not value or value.upper() == 'NONE'):
             return None
         if name == 'DeprecatedXUnit':
@@ -237,14 +237,21 @@
             return colors[0], colors[0], colors[1]
         return tuple(colors)

-    def _process_tag_stat_combine(self, value):
-        for replwhat, replwith in [('&', 'AND'), ('AND', ' AND '),
-                                   ('OR', ' OR '), ('NOT', ' NOT ')]:
-            value = value.replace(replwhat, replwith)
-        if ':' not in value:
-            return value, ''
-        pattern, title = value.rsplit(':', 1)
-        return pattern, title.replace('_', ' ')
+    def _process_tag_stat_combine(self, pattern):
+        if ':' in pattern:
+            pattern, title = pattern.rsplit(':', 1)
+        else:
+            title = ''
+        return self._format_tag_patterns(pattern), title.replace('_', ' ')
+
+    def _format_tag_patterns(self, pattern):
+ for search, replace in [('&', 'AND'), ('AND', ' AND '), ('OR', ' OR '),
+                                ('NOT', ' NOT '), ('_', ' ')]:
+            if search in pattern:
+                pattern = pattern.replace(search, replace)
+        while '  ' in pattern:
+            pattern = pattern.replace('  ', ' ')
+        return pattern

     def _process_tag_stat_link(self, value):
         tokens = value.split(':')
=======================================
--- /src/robot/model/tags.py    Fri Jan 24 00:22:03 2014 UTC
+++ /src/robot/model/tags.py    Fri Jan 24 14:36:55 2014 UTC
@@ -94,13 +94,12 @@


 def TagPattern(pattern):
-    pattern = pattern.replace('&', 'AND')
     if 'NOT' in pattern:
         return _NotTagPattern(*pattern.split('NOT'))
     if 'OR' in pattern:
         return _OrTagPattern(pattern.split('OR'))
-    if 'AND' in pattern:
-        return _AndTagPattern(pattern.split('AND'))
+    if 'AND' in pattern or '&' in pattern:
+        return _AndTagPattern(pattern.replace('&', 'AND').split('AND'))
     return _SingleTagPattern(pattern)



==============================================================================
Revision: 7918c89f29bf
Branch:   default
Author:   Pekka Klärck
Date:     Fri Jan 24 14:37:01 2014 UTC
Log:      Automated merge with https://code.google.com/p/robotframework/
http://code.google.com/p/robotframework/source/detail?r=7918c89f29bf


--

--- You received this message because you are subscribed to the Google Groups "robotframework-commit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to