2 new revisions:

Revision: 872647e40563
Author:   Pekka Klärck
Date:     Thu Nov  3 16:59:47 2011
Log:      removed unnecessary test that got broken
http://code.google.com/p/robotframework/source/detail?r=872647e40563

Revision: ce35ee9947c5
Author:   Pekka Klärck
Date:     Thu Nov  3 17:13:41 2011
Log: Filtering w/ rebot: Good error also when suite contains no tests and n...
http://code.google.com/p/robotframework/source/detail?r=ce35ee9947c5

==============================================================================
Revision: 872647e40563
Author:   Pekka Klärck
Date:     Thu Nov  3 16:59:47 2011
Log:      removed unnecessary test that got broken
http://code.google.com/p/robotframework/source/detail?r=872647e40563

Deleted:
 /atest/testdata/rebot/created_minimal.xml
Modified:
 /atest/robot/output/processing_output.txt

=======================================
--- /atest/testdata/rebot/created_minimal.xml   Sat May 31 09:57:24 2008
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Absolutely most minimal but kind-of valid Robot output -->
-<robot>
-  <suite name="My Name">
-    <status status="PASS"/>
-  </suite>
-</robot>
=======================================
--- /atest/robot/output/processing_output.txt   Tue Nov  1 01:43:56 2011
+++ /atest/robot/output/processing_output.txt   Thu Nov  3 16:59:47 2011
@@ -26,15 +26,7 @@
     Should Be True   ${SUITE.get_metadata()} == [('a', 'b'), ('x', 'y')]
     Check Suite Got From misc/suites/ Directory

-Created Minimal
- [Documentation] Testing absolute minimal hand created suite without even any tests or subsuites
-    Run Rebot  ${EMPTY}  rebot/created_minimal.xml
-    Should Be Equal  ${SUITE.name}  My Name
-    Should Be Equal  ${SUITE.status}  PASS
-    Should Be True  ${SUITE.suites}+${SUITE.tests}==[]
-    Check Minimal Suite Defaults  ${SUITE}
-
-Created Normal
+Minimal hand-created output
[Documentation] Testing minimal hand created suite with tests or subsuites
     Run Rebot  ${EMPTY}  rebot/created_normal.xml
     Check Names  ${SUITE}  Root

==============================================================================
Revision: ce35ee9947c5
Author:   Pekka Klärck
Date:     Thu Nov  3 17:13:41 2011
Log: Filtering w/ rebot: Good error also when suite contains no tests and no filter is used. This is only tested with unit tests but that ought to be fine.
http://code.google.com/p/robotframework/source/detail?r=ce35ee9947c5

Modified:
 /atest/robot/rebot/filter_by_names.txt
 /atest/robot/tags/include_and_exclude_with_rebot.txt
 /src/robot/result/configurer.py
 /utest/result/test_configurer.py

=======================================
--- /atest/robot/rebot/filter_by_names.txt      Thu Nov  3 16:34:06 2011
+++ /atest/robot/rebot/filter_by_names.txt      Thu Nov  3 17:13:41 2011
@@ -57,17 +57,17 @@
 No Matching tests
     Run Rebot Without Processing Output  --test nonex  ${INPUT FILE}
     ${stderr} =  Get Stderr
- Should Be Equal ${stderr.strip()} [ ERROR ] Suite 'Many Tests & Suites' contains no test named 'nonex'.${USAGE_TIP} + Should Be Equal ${stderr.strip()} [ ERROR ] Suite 'Many Tests & Suites' contains no tests named 'nonex'.${USAGE_TIP}

 No Matching Suites
Run Rebot Without Processing Output --suite nonex -s n2 -s n3 ${INPUT FILE}
     ${stderr} =  Get Stderr
- Should Be Equal ${stderr.strip()} [ ERROR ] Suite 'Many Tests & Suites' contains no test in suites 'nonex', 'n2' or 'n3'.${USAGE_TIP} + Should Be Equal ${stderr.strip()} [ ERROR ] Suite 'Many Tests & Suites' contains no tests in suites 'nonex', 'n2' or 'n3'.${USAGE_TIP}

 No Matching Tests In Matching Suites
Run Rebot Without Processing Output --suite nonex --suite suites --test first --test nonex --test STARone ${ESCAPES} ${INPUT FILE}
     ${stderr} =  Get Stderr
- Should Be Equal ${stderr.strip()} [ ERROR ] Suite 'Many Tests & Suites' contains no test named 'first', 'nonex' or '*one' in suites 'nonex' or 'suites'.${USAGE_TIP} + Should Be Equal ${stderr.strip()} [ ERROR ] Suite 'Many Tests & Suites' contains no tests named 'first', 'nonex' or '*one' in suites 'nonex' or 'suites'.${USAGE_TIP}

 Elapsed Time
[Documentation] Test setting start, end and elapsed times correctly when filtering by tags
=======================================
--- /atest/robot/tags/include_and_exclude_with_rebot.txt Thu Nov 3 16:34:06 2011 +++ /atest/robot/tags/include_and_exclude_with_rebot.txt Thu Nov 3 17:13:41 2011
@@ -139,5 +139,5 @@
     [Arguments]  ${params}  ${filter_msg}
Run Rebot Without Processing Output ${params} ${ESCAPES} ${INPUT FILE}
     ${stderr} =  Get Stderr
- Should Be Equal ${stderr.strip()} [ ERROR ] Suite 'Include And Exclude' contains no test ${filter_msg}.\n\n Try --help for usage information. + Should Be Equal ${stderr.strip()} [ ERROR ] Suite 'Include And Exclude' contains no tests ${filter_msg}.\n\n Try --help for usage information.
     File Should Not Exist  ${OUTFILE}
=======================================
--- /src/robot/result/configurer.py     Thu Nov  3 16:34:06 2011
+++ /src/robot/result/configurer.py     Thu Nov  3 17:13:41 2011
@@ -51,7 +51,7 @@
         suite.filter(self.include_suites, self.include_tests,
                      self.include_tags, self.exclude_tags)
         if not suite.test_count:
-            self._raise_no_matching_tests_error(suite.name)
+            self._raise_no_tests_error(suite.name)
         suite.set_tags(self.add_tags, self.remove_tags)
         suite.remove_keywords(self.remove_keywords)
         suite.filter_messages(self.log_level)
@@ -79,10 +79,11 @@
             return None
         return utils.secs_to_timestamp(secs, millis=True)

-    def _raise_no_matching_tests_error(self, suite):
-        msg = '%s %s' % (self._get_test_selector_msgs(),
-                         self._get_suite_selector_msg())
- raise DataError("Suite '%s' contains no test %s." % (suite, msg.strip()))
+    def _raise_no_tests_error(self, suite):
+        selectors = '%s %s' % (self._get_test_selector_msgs(),
+                               self._get_suite_selector_msg())
+ msg = "Suite '%s' contains no tests %s" % (suite, selectors.strip())
+        raise DataError(msg.strip() + '.')

     def _get_test_selector_msgs(self):
         parts = []
=======================================
--- /utest/result/test_configurer.py    Thu Nov  3 16:34:06 2011
+++ /utest/result/test_configurer.py    Thu Nov  3 17:13:41 2011
@@ -84,7 +84,7 @@
         configurer = SuiteConfigurer(include_tags='i', exclude_tags='e',
                                      include_suites='s', include_tests='t')
         assert_raises_with_msg(DataError,
- "Suite 'root' contains no test with tag 'i', " + "Suite 'root' contains no tests with tag 'i', " "without tag 'e' and named 't' in suite 's'.",
                                configurer.configure, self.suite)

@@ -94,11 +94,17 @@
                                      include_suites=['s1', 's2', 's3'],
                                      include_tests=['t1', 't2'])
         assert_raises_with_msg(DataError,
- "Suite 'root' contains no test with tags 'i1' or 'i2', " + "Suite 'root' contains no tests with tags 'i1' or 'i2', " "without tags 'e1' or 'e2' and named 't1' or 't2' "
                                "in suites 's1', 's2' or 's3'.",
                                configurer.configure, self.suite)

+    def test_empty_suite(self):
+        assert_raises_with_msg(DataError,
+                               "Suite 'x' contains no tests.",
+ SuiteConfigurer().configure, TestSuite(name='x'))
+
+
 class TestRemoveKeywords(unittest.TestCase):

     def test_remove_all_removes_all(self):

Reply via email to