4 new revisions:

Revision: c5677c552b7d
Branch:   default
Author:   Robot Framework Developers (robotframew...@gmail.com)
Date:     Wed Sep 11 12:40:01 2013 UTC
Log:      --rmkws atests: removed unnecessary empty lines and logging
http://code.google.com/p/robotframework/source/detail?r=c5677c552b7d

Revision: ab71930eb15a
Branch:   default
Author:   Robot Framework Developers (robotframew...@gmail.com)
Date:     Wed Sep 11 12:49:18 2013 UTC
Log: --rmkws atests: refactored suite containing tests for all/passedmodes ...
http://code.google.com/p/robotframework/source/detail?r=ab71930eb15a

Revision: 93fb564942cc
Branch:   default
Author:   Robot Framework Developers (robotframew...@gmail.com)
Date:     Wed Sep 11 13:27:59 2013 UTC
Log:      Enhanced --RemoveKeywords NAME:<pattern> tests....
http://code.google.com/p/robotframework/source/detail?r=93fb564942cc

Revision: 0d38b125afb4
Branch:   default
Author:   Robot Framework Developers (robotframew...@gmail.com)
Date:     Wed Sep 11 13:28:54 2013 UTC
Log:      --RemoveKeywords cleanup....
http://code.google.com/p/robotframework/source/detail?r=0d38b125afb4

==============================================================================
Revision: c5677c552b7d
Branch:   default
Author:   Robot Framework Developers (robotframew...@gmail.com)
Date:     Wed Sep 11 12:40:01 2013 UTC
Log:      --rmkws atests: removed unnecessary empty lines and logging
http://code.google.com/p/robotframework/source/detail?r=c5677c552b7d

Modified:
 /atest/robot/cli/runner/remove_keywords.txt
 /atest/testdata/cli/remove_keywords/all_combinations.txt

=======================================
--- /atest/robot/cli/runner/remove_keywords.txt Tue Sep 10 12:53:19 2013 UTC
+++ /atest/robot/cli/runner/remove_keywords.txt Wed Sep 11 12:40:01 2013 UTC
@@ -120,12 +120,10 @@
 Test should contain NAME messages with * pattern
     [Arguments]    ${name}
     ${tc}=    Check test case    ${name}
-        Log    ${tc.kws}
Check log message ${tc.kws[0].kws[0].msgs[0]} ${REMOVED BY PATTERN MESSAGE} Check log message ${tc.kws[1].kws[0].msgs[0]} ${REMOVED BY PATTERN MESSAGE} Check log message ${tc.kws[2].kws[0].kws[0].msgs[0]} ${REMOVED BY PATTERN MESSAGE} Check log message ${tc.kws[2].kws[1].msgs[0]} ${KEPT BY PATTERN MESSAGE}
-

 Test should contain NAME messages with ? pattern
     [Arguments]    ${name}
@@ -133,4 +131,3 @@
Check log message ${tc.kws[0].kws[0].msgs[0]} ${REMOVED BY PATTERN MESSAGE} Check log message ${tc.kws[1].kws[0].kws[0].msgs[0]} ${REMOVED BY PATTERN MESSAGE} Check log message ${tc.kws[1].kws[1].msgs[0]} ${KEPT BY PATTERN MESSAGE}
-
=======================================
--- /atest/testdata/cli/remove_keywords/all_combinations.txt Tue Sep 10 12:53:19 2013 UTC +++ /atest/testdata/cli/remove_keywords/all_combinations.txt Wed Sep 11 12:40:01 2013 UTC
@@ -52,7 +52,6 @@
     This should be removed also
     This should not be removed

-
 NAME with * pattern when test fails
     [Documentation]    FAIL this fails
     This should be removed

==============================================================================
Revision: ab71930eb15a
Branch:   default
Author:   Robot Framework Developers (robotframew...@gmail.com)
Date:     Wed Sep 11 12:49:18 2013 UTC
Log: --rmkws atests: refactored suite containing tests for all/passedmodes to ease adding name tests there too
http://code.google.com/p/robotframework/source/detail?r=ab71930eb15a

Modified:
 /atest/robot/cli/rebot/remove_keywords/all_and_passed.txt

=======================================
--- /atest/robot/cli/rebot/remove_keywords/all_and_passed.txt Sun May 26 08:39:58 2013 UTC +++ /atest/robot/cli/rebot/remove_keywords/all_and_passed.txt Wed Sep 11 12:49:18 2013 UTC
@@ -6,7 +6,7 @@
 Resource          remove_keywords_resource.txt

 *** Test Cases ***
-Remove All
+All Mode
     [Setup]    Run Rebot and Set My Suite    --RemoveKeywords ALL    0
Keyword Should Be Empty ${MY SUITE.setup} My Keyword Suite Setup
     Keyword Should Contain Removal Message    ${MY SUITE.setup}
@@ -18,7 +18,17 @@
Keyword Should Be Empty ${tc2.keywords[1]} BuiltIn.Fail Expected failure Keyword Should Contain Removal Message ${tc2.keywords[1]} Fails the test with the given message and optionally alters its tags.\n\n

-Remove Passed
+Warnings Are Removed In All Mode
+    [Setup]    Run Rebot and Set My Suite    --removekeywords All    1
+ Keyword Should Be Empty ${MY SUITE.setup} Warning in suite setup + Keyword Should Be Empty ${MY SUITE.teardown} Warning in suite teardown
+    ${tc1}    ${tc2}=    Set Variable    ${MY SUITE.tests}
+    Length Should Be    ${tc1.kws}    1
+    Length Should Be    ${tc2.kws}    1
+    Keyword Should Be Empty    ${tc1.kws[0]}    Warning in    test case
+ Keyword Should Be Empty ${tc2.kws[0]} BuiltIn.Log No warnings here
+
+Passed Mode
     [Setup]    Run Rebot and Set My Suite    --removekeywords passed    0
Keyword Should Not Be Empty ${MY SUITE.setup} My Keyword Suite Setup
     ${tc1}    ${tc2} =    Set Variable    ${MY SUITE.tests}
@@ -29,7 +39,7 @@
     Keyword Should Not Be Empty    ${tc2.keywords[0]}    My Keyword    Fail
Keyword Should Not Be Empty ${tc2.keywords[1]} BuiltIn.Fail Expected failure

-Keywords With Warnings Are Not Removed When Passed are Removed
+Warnings Are Not Removed In Passed Mode
     [Setup]    Run Rebot and Set My Suite    --removekeywords Passed    1
Keyword Should Not Be Empty ${MY SUITE.setup} Warning in suite setup Keyword Should Not Be Empty ${MY SUITE.teardown} Warning in suite teardown
@@ -40,16 +50,6 @@
Keyword Should Not Be Empty ${tc1.kws[0].kws[0]} BuiltIn.Log Warning in \${where} WARN Keyword Should Be Empty ${tc2.kws[0]} BuiltIn.Log No warnings here

-Keywords With Warnings Are Removed When All are Removed
-    [Setup]    Run Rebot and Set My Suite    --removekeywords All    1
- Keyword Should Be Empty ${MY SUITE.setup} Warning in suite setup - Keyword Should Be Empty ${MY SUITE.teardown} Warning in suite teardown
-    ${tc1}    ${tc2}=    Set Variable    ${MY SUITE.tests}
-    Length Should Be    ${tc1.kws}    1
-    Length Should Be    ${tc2.kws}    1
-    Keyword Should Be Empty    ${tc1.kws[0]}    Warning in    test case
- Keyword Should Be Empty ${tc2.kws[0]} BuiltIn.Log No warnings here
-
 *** Keywords ***
 Run Some Tests
Create Output With Robot ${INPUTFILE} ${EMPTY} misc${/}pass_and_fail.txt misc${/}warnings_and_errors.txt

==============================================================================
Revision: 93fb564942cc
Branch:   default
Author:   Robot Framework Developers (robotframew...@gmail.com)
Date:     Wed Sep 11 13:27:59 2013 UTC
Log:      Enhanced --RemoveKeywords NAME:<pattern> tests.

Update issue 1480
This new feature was tested only at run time when --RemoveKeywords actually is tested more thoroughly with Rebot. Added these missing tests, and also tested
that keywords containing warnings are not removed.
http://code.google.com/p/robotframework/source/detail?r=93fb564942cc

Added:
 /atest/robot/cli/rebot/remove_keywords/all_passed_and_name.txt
Deleted:
 /atest/robot/cli/rebot/remove_keywords/all_and_passed.txt

=======================================
--- /dev/null
+++ /atest/robot/cli/rebot/remove_keywords/all_passed_and_name.txt Wed Sep 11 13:27:59 2013 UTC
@@ -0,0 +1,91 @@
+*** Settings ***
+Documentation Testing ALL and PASSED modes with --RemoveKeywords option.
+Suite Setup       Run Some Tests
+Suite Teardown    Remove File    ${INPUTFILE}
+Force Tags        regression    pybot    jybot
+Resource          remove_keywords_resource.txt
+
+*** Test Cases ***
+All Mode
+    [Setup]    Run Rebot and Set My Suite    --RemoveKeywords ALL    0
+ Keyword Should Be Empty ${MY SUITE.setup} My Keyword Suite Setup
+    Keyword Should Contain Removal Message    ${MY SUITE.setup}
+    ${tc1}    ${tc2} =    Set Variable    ${MY SUITE.tests}
+    Length Should Be    ${tc1.kws}    1
+    Keyword Should Be Empty    ${tc1.kws[0]}    My Keyword    Pass
+    Length Should Be    ${tc2.kws}    2
+    Keyword Should Be Empty    ${tc2.kws[0]}    My Keyword    Fail
+ Keyword Should Be Empty ${tc2.kws[1]} BuiltIn.Fail Expected failure + Keyword Should Contain Removal Message ${tc2.kws[1]} Fails the test with the given message and optionally alters its tags.
+
+Warnings Are Removed In All Mode
+    [Setup]    Run Rebot and Set My Suite    --removekeywords All    1
+ Keyword Should Be Empty ${MY SUITE.setup} Warning in suite setup + Keyword Should Be Empty ${MY SUITE.teardown} Warning in suite teardown
+    ${tc1}    ${tc2}=    Set Variable    ${MY SUITE.tests}
+    Length Should Be    ${tc1.kws}    1
+    Length Should Be    ${tc2.kws}    1
+    Keyword Should Be Empty    ${tc1.kws[0]}    Warning in    test case
+ Keyword Should Be Empty ${tc2.kws[0]} BuiltIn.Log No warnings here
+
+Passed Mode
+    [Setup]    Run Rebot and Set My Suite    --removekeywords passed    0
+ Keyword Should Not Be Empty ${MY SUITE.setup} My Keyword Suite Setup
+    ${tc1}    ${tc2} =    Set Variable    ${MY SUITE.tests}
+    Length Should Be    ${tc1.kws}    1
+    Keyword Should Be Empty    ${tc1.keywords[0]}    My Keyword    Pass
+    Keyword Should Contain Removal Message     ${tc1.keywords[0]}
+    Length Should Be    ${tc2.kws}    2
+    Keyword Should Not Be Empty    ${tc2.kws[0]}    My Keyword    Fail
+ Keyword Should Not Be Empty ${tc2.kws[1]} BuiltIn.Fail Expected failure
+
+Warnings Are Not Removed In Passed Mode
+    [Setup]    Run Rebot and Set My Suite    --removekeywords Passed    1
+ Keyword Should Not Be Empty ${MY SUITE.setup} Warning in suite setup + Keyword Should Not Be Empty ${MY SUITE.teardown} Warning in suite teardown
+    ${tc1}    ${tc2}=    Set Variable    ${MY SUITE.tests}
+    Length Should Be    ${tc1.kws}    1
+    Keyword Should Not Be Empty    ${tc1.kws[0]}    Warning in    test case
+ Keyword Should Not Be Empty ${tc1.kws[0].kws[0]} BuiltIn.Log Warning in \${where} WARN
+    Length Should Be    ${tc2.kws}    1
+ Keyword Should Be Empty ${tc2.kws[0]} BuiltIn.Log No warnings here
+
+Name Mode
+ [Setup] Run Rebot and Set My Suite --removekeywords name:BuiltIn.Fail --RemoveK NAME:??_KEYWORD 0 + Keyword Should Be Empty ${MY SUITE.setup} My Keyword Suite Setup
+    Keyword Should Contain Removal Message    ${MY SUITE.setup}
+    ${tc1}    ${tc2} =    Set Variable    ${MY SUITE.tests}
+    Length Should Be    ${tc1.kws}    1
+    Keyword Should Be Empty    ${tc1.kws[0]}    My Keyword    Pass
+    Keyword Should Contain Removal Message    ${tc1.kws[0]}
+    Length Should Be    ${tc2.kws}    2
+    Keyword Should Be Empty    ${tc2.kws[0]}    My Keyword    Fail
+    Keyword Should Contain Removal Message    ${tc2.kws[0]}
+ Keyword Should Be Empty ${tc2.kws[1]} BuiltIn.Fail Expected failure
+    Keyword Should Contain Removal Message    ${tc2.kws[0]}
+
+Warnings Are Not Removed In Name Mode
+ [Setup] Run Rebot and Set My Suite --removekeywords NaMe:BuiltIn.Log --RemoveK NaMe:W*IN 1 + Keyword Should Not Be Empty ${MY SUITE.setup} Warning in suite setup + Keyword Should Not Be Empty ${MY SUITE.teardown} Warning in suite teardown
+    ${tc1}    ${tc2}=    Set Variable    ${MY SUITE.tests}
+    Length Should Be    ${tc1.kws}    1
+    Length Should Be    ${tc2.kws}    1
+    Keyword Should Not Be Empty    ${tc1.kws[0]}    Warning in    test case
+ Keyword Should Not Be Empty ${tc1.kws[0].kws[0]} BuiltIn.Log Warning in \${where} WARN + Keyword Should Be Empty ${tc2.kws[0]} BuiltIn.Log No warnings here
+
+*** Keywords ***
+Run Some Tests
+ Create Output With Robot ${INPUTFILE} ${EMPTY} misc/pass_and_fail.txt misc/warnings_and_errors.txt
+
+Run Rebot And Set My Suite
+    [Arguments]    ${rebot params}    ${suite index}
+    Run Rebot    ${rebot params}    ${INPUTFILE}
+    Should Not Be Equal    ${SUITE}    ${None}    Errors in test execution
+    Set Test Variable    ${MY SUITE}    ${SUITE.suites[${suite index}]}
+
+Keyword Should Contain Removal Message
+    [Arguments]    ${keyword}    ${doc}=${EMPTY}
+ ${expected} = Set Variable ${doc}\n\n_Keyword data removed using --RemoveKeywords option._
+    Should Be Equal  ${keyword.doc}  ${expected.strip()}
=======================================
--- /atest/robot/cli/rebot/remove_keywords/all_and_passed.txt Wed Sep 11 12:49:18 2013 UTC
+++ /dev/null
@@ -1,66 +0,0 @@
-*** Settings ***
-Documentation Testing ALL and PASSED modes with --RemoveKeywords option.
-Suite Setup       Run Some Tests
-Suite Teardown    Remove File    ${INPUTFILE}
-Force Tags        regression    pybot    jybot
-Resource          remove_keywords_resource.txt
-
-*** Test Cases ***
-All Mode
-    [Setup]    Run Rebot and Set My Suite    --RemoveKeywords ALL    0
- Keyword Should Be Empty ${MY SUITE.setup} My Keyword Suite Setup
-    Keyword Should Contain Removal Message    ${MY SUITE.setup}
-    ${tc1}    ${tc2} =    Set Variable    ${MY SUITE.tests}
-    Length Should Be    ${tc1.keywords}    1
-    Keyword Should Be Empty    ${tc1.keywords[0]}    My Keyword    Pass
-    Length Should Be    ${tc2.keywords}    2
-    Keyword Should Be Empty    ${tc2.keywords[0]}    My Keyword    Fail
- Keyword Should Be Empty ${tc2.keywords[1]} BuiltIn.Fail Expected failure - Keyword Should Contain Removal Message ${tc2.keywords[1]} Fails the test with the given message and optionally alters its tags.\n\n
-
-Warnings Are Removed In All Mode
-    [Setup]    Run Rebot and Set My Suite    --removekeywords All    1
- Keyword Should Be Empty ${MY SUITE.setup} Warning in suite setup - Keyword Should Be Empty ${MY SUITE.teardown} Warning in suite teardown
-    ${tc1}    ${tc2}=    Set Variable    ${MY SUITE.tests}
-    Length Should Be    ${tc1.kws}    1
-    Length Should Be    ${tc2.kws}    1
-    Keyword Should Be Empty    ${tc1.kws[0]}    Warning in    test case
- Keyword Should Be Empty ${tc2.kws[0]} BuiltIn.Log No warnings here
-
-Passed Mode
-    [Setup]    Run Rebot and Set My Suite    --removekeywords passed    0
- Keyword Should Not Be Empty ${MY SUITE.setup} My Keyword Suite Setup
-    ${tc1}    ${tc2} =    Set Variable    ${MY SUITE.tests}
-    Length Should Be    ${tc1.keywords}    1
-    Keyword Should Be Empty    ${tc1.keywords[0]}    My Keyword    Pass
-    Keyword Should Contain Removal Message     ${tc1.keywords[0]}
-    Length Should Be    ${tc2.keywords}    2
-    Keyword Should Not Be Empty    ${tc2.keywords[0]}    My Keyword    Fail
- Keyword Should Not Be Empty ${tc2.keywords[1]} BuiltIn.Fail Expected failure
-
-Warnings Are Not Removed In Passed Mode
-    [Setup]    Run Rebot and Set My Suite    --removekeywords Passed    1
- Keyword Should Not Be Empty ${MY SUITE.setup} Warning in suite setup - Keyword Should Not Be Empty ${MY SUITE.teardown} Warning in suite teardown
-    ${tc1}    ${tc2}=    Set Variable    ${MY SUITE.tests}
-    Length Should Be    ${tc1.kws}    1
-    Length Should Be    ${tc2.kws}    1
-    Keyword Should Not Be Empty    ${tc1.kws[0]}    Warning in    test case
- Keyword Should Not Be Empty ${tc1.kws[0].kws[0]} BuiltIn.Log Warning in \${where} WARN - Keyword Should Be Empty ${tc2.kws[0]} BuiltIn.Log No warnings here
-
-*** Keywords ***
-Run Some Tests
- Create Output With Robot ${INPUTFILE} ${EMPTY} misc${/}pass_and_fail.txt misc${/}warnings_and_errors.txt
-
-Run Rebot And Set My Suite
-    [Arguments]    ${rebot params}    ${suite index}
-    Run Rebot    ${rebot params}    ${INPUTFILE}
-    Should Not Be Equal    ${SUITE}    ${None}    Errors in test execution
-    Set Test Variable    ${MY SUITE}    ${SUITE.suites[${suite index}]}
-
-Keyword Should Contain Removal Message
-    [Arguments]    ${keyword}    ${doc}=${EMPTY}
- Should Be Equal ${keyword.doc} ${doc}_Keyword data removed using --RemoveKeywords option._
-

==============================================================================
Revision: 0d38b125afb4
Branch:   default
Author:   Robot Framework Developers (robotframew...@gmail.com)
Date:     Wed Sep 11 13:28:54 2013 UTC
Log:      --RemoveKeywords cleanup.

Update issue 1480
Status: Done
Cleaned up the code a little. This issue can be considered done.
http://code.google.com/p/robotframework/source/detail?r=0d38b125afb4

Modified:
 /src/robot/result/keywordremover.py

=======================================
--- /src/robot/result/keywordremover.py Tue Sep 10 12:53:52 2013 UTC
+++ /src/robot/result/keywordremover.py Wed Sep 11 13:28:54 2013 UTC
@@ -18,15 +18,15 @@


 def KeywordRemover(how):
-    if ':' in how and how.startswith('NAME'):
-        _, pattern = how.split(':', 1)
-        return ByNameKeywordRemover(pattern)
+    how = how.upper()
+    if how.startswith('NAME:'):
+        return ByNameKeywordRemover(pattern=how[5:])
     return {
         'PASSED': PassedKeywordRemover,
         'FOR': ForLoopItemsRemover,
         'ALL': AllKeywordsRemover,
         'WUKS': WaitUntilKeywordSucceedsRemover,
-    }.get(how.upper(), SkipAllVisitor)()  # TODO: Should fail, not skip
+    }.get(how, SkipAllVisitor)()  # TODO: Should fail, not skip


 class _KeywordRemover(SuiteVisitor):
@@ -72,6 +72,17 @@
         pass


+class ByNameKeywordRemover(_KeywordRemover):
+
+    def __init__(self, pattern):
+        _KeywordRemover.__init__(self)
+        self._matcher = Matcher(pattern, ignore='_')
+
+    def start_keyword(self, kw):
+        if self._matcher.match(kw.name) and not self._contains_warning(kw):
+            self._clear_content(kw)
+
+
 class ForLoopItemsRemover(_KeywordRemover):
     _message = '%d passing step%s removed using --RemoveKeywords option.'

@@ -135,14 +146,3 @@

     def set(self, kw, message=None):
kw.doc = ('%s\n\n_%s_' % (kw.doc, message or self._message)).strip()
-
-
-class ByNameKeywordRemover(_KeywordRemover):
-
-    def __init__(self, pattern):
-        super(ByNameKeywordRemover, self).__init__()
-        self._matcher = Matcher(pattern, ignore='_')
-
-    def start_keyword(self, kw):
-        if self._matcher.match(kw.name) and not self._contains_warning(kw):
-            self._clear_content(kw)

--

--- 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 robotframework-commit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to