4 new revisions:

Revision: e48bbd670c67
Author:   Pekka Klärck
Date:     Fri Nov  4 06:56:29 2011
Log:      cleanup + todo
http://code.google.com/p/robotframework/source/detail?r=e48bbd670c67

Revision: a48648e7164c
Author:   Pekka Klärck
Date:     Fri Nov  4 06:57:47 2011
Log:      expose often used model classes in robot.model.__init__
http://code.google.com/p/robotframework/source/detail?r=a48648e7164c

Revision: b9526c8f2c3e
Author:   Pekka Klärck
Date:     Fri Nov  4 07:15:54 2011
Log:      New Critical implementation
http://code.google.com/p/robotframework/source/detail?r=b9526c8f2c3e

Revision: 0ee7bb4a5df2
Author:   Pekka Klärck
Date:     Fri Nov  4 07:15:58 2011
Log:      Automated merge with https://code.google.com/p/robotframework/
http://code.google.com/p/robotframework/source/detail?r=0ee7bb4a5df2

==============================================================================
Revision: e48bbd670c67
Author:   Pekka Klärck
Date:     Fri Nov  4 06:56:29 2011
Log:      cleanup + todo
http://code.google.com/p/robotframework/source/detail?r=e48bbd670c67

Modified:
 /src/robot/model/tags.py

=======================================
--- /src/robot/model/tags.py    Fri Nov  4 05:27:22 2011
+++ /src/robot/model/tags.py    Fri Nov  4 06:56:29 2011
@@ -58,7 +58,7 @@
         self._patterns = [TagPattern(p) for p in Tags(patterns)]

     def match(self, tags):
-        tags = Tags(tags)
+        tags = tags if isinstance(tags, Tags) else Tags(tags)
         return any(p.match(tags) for p in self._patterns)

     def __contains__(self, tag):
@@ -89,6 +89,8 @@
         return any(self._match(tag) for tag in tags)

     def _match(self, tag):
+ # TODO: We should create utils.Matcher that could normalize patterns
+        # only once and also compile the regexp used internally
         return utils.matches(tag, self._pattern, ignore=['_'])


@@ -105,7 +107,7 @@

     def __init__(self, must_match, must_not_match):
         self._must = TagPattern(must_match)
-        self._not = TagPattern(must_not_match)
+        self._must_not = TagPattern(must_not_match)

     def match(self, tags):
-        return self._must.match(tags) and not self._not.match(tags)
+        return self._must.match(tags) and not self._must_not.match(tags)

==============================================================================
Revision: a48648e7164c
Author:   Pekka Klärck
Date:     Fri Nov  4 06:57:47 2011
Log:      expose often used model classes in robot.model.__init__
http://code.google.com/p/robotframework/source/detail?r=a48648e7164c

Modified:
 /src/robot/model/__init__.py
 /src/robot/result/filter.py

=======================================
--- /src/robot/model/__init__.py        Fri Nov  4 05:17:02 2011
+++ /src/robot/model/__init__.py        Fri Nov  4 06:57:47 2011
@@ -0,0 +1,15 @@
+#  Copyright 2008-2011 Nokia Siemens Networks Oyj
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+from tags import Tags, TagPatterns
=======================================
--- /src/robot/result/filter.py Fri Nov  4 05:27:22 2011
+++ /src/robot/result/filter.py Fri Nov  4 06:57:47 2011
@@ -14,7 +14,7 @@

 from robot import utils
 from robot.output.loggerhelper import IsLogged
-from robot.model.tags import TagPatterns
+from robot.model import TagPatterns

 from visitor import Visitor


==============================================================================
Revision: b9526c8f2c3e
Author:   Pekka Klärck
Date:     Fri Nov  4 07:15:54 2011
Log:      New Critical implementation
http://code.google.com/p/robotframework/source/detail?r=b9526c8f2c3e

Added:
 /src/robot/model/critical.py
Modified:
 /src/robot/model/__init__.py
 /src/robot/result/model.py

=======================================
--- /dev/null
+++ /src/robot/model/critical.py        Fri Nov  4 07:15:54 2011
@@ -0,0 +1,42 @@
+#  Copyright 2008-2011 Nokia Siemens Networks Oyj
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+from tags import TagPatterns
+
+
+class Critical(object):
+
+    def __init__(self, critical_tags=None, non_critical_tags=None):
+        self.critical_tags = TagPatterns(critical_tags)
+        self.non_critical_tags = TagPatterns(non_critical_tags)
+
+    def tag_is_critical(self, tag):
+        return self.critical_tags.match(tag)
+
+    def tag_is_non_critical(self, tag):
+        return self.non_critical_tags.match(tag)
+
+    def test_is_critical(self, test):
+        if self.non_critical_tags.match(test.tags):
+            return False
+        if self.critical_tags.match(test.tags):
+            return True
+        return not self.critical_tags
+
+    def __nonzero__(self):
+        return bool(self.critical_tags or self.non_critical_tags)
+
+    # TODO: Remove below compatibility code when possible
+    is_critical = tag_is_critical
+    is_non_critical = tag_is_non_critical
=======================================
--- /src/robot/model/__init__.py        Fri Nov  4 06:57:47 2011
+++ /src/robot/model/__init__.py        Fri Nov  4 07:15:54 2011
@@ -13,3 +13,4 @@
 #  limitations under the License.

 from tags import Tags, TagPatterns
+from critical import Critical
=======================================
--- /src/robot/result/model.py  Fri Nov  4 05:27:22 2011
+++ /src/robot/result/model.py  Fri Nov  4 07:15:54 2011
@@ -12,11 +12,10 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.

-from robot.common.model import _Critical  # TODO: Remove
 from robot.common.statistics import CriticalStats, AllStats, Statistics
 from robot.output.loggerhelper import Message as BaseMessage
 from robot import utils
-from robot.model.tags import Tags
+from robot.model import Tags, Critical

 from tagsetter import TagSetter
 from filter import Filter, MessageFilter
@@ -107,7 +106,7 @@

     def set_criticality(self, critical_tags=None, non_critical_tags=None):
         # TODO: should settings criticality be prevented for sub suites?
-        self._critical = _Critical(critical_tags, non_critical_tags)
+        self._critical = Critical(critical_tags, non_critical_tags)

     @property
     def critical(self):
@@ -116,7 +115,7 @@
         if self.parent:
             return self.parent.critical
         if self._critical is None:
-            self._critical = _Critical()
+            self._critical = Critical()
         return self._critical

     @utils.setter
@@ -256,7 +255,7 @@

     @property
     def critical(self):
- return 'yes' if self.parent.critical.are_critical(self.tags) else 'no' + return 'yes' if self.parent.critical.test_is_critical(self) else 'no'

     @property
     def is_passed(self):

==============================================================================
Revision: 0ee7bb4a5df2
Author:   Pekka Klärck
Date:     Fri Nov  4 07:15:58 2011
Log:      Automated merge with https://code.google.com/p/robotframework/
http://code.google.com/p/robotframework/source/detail?r=0ee7bb4a5df2


Reply via email to