2 new revisions:

Revision: c6012fc37a1c
Branch:   default
Author:   Pekka Klärck
Date:     Fri Dec 14 01:37:16 2012
Log:      cleanup
http://code.google.com/p/robotframework/source/detail?r=c6012fc37a1c

Revision: bb70314743a4
Branch:   default
Author:   Pekka Klärck
Date:     Fri Dec 14 01:53:50 2012
Log: Clean-up: Comment is a comment, not a setting (i.e. moved Comment clas...
http://code.google.com/p/robotframework/source/detail?r=bb70314743a4

==============================================================================
Revision: c6012fc37a1c
Branch:   default
Author:   Pekka Klärck
Date:     Fri Dec 14 01:37:16 2012
Log:      cleanup
http://code.google.com/p/robotframework/source/detail?r=c6012fc37a1c

Modified:
 /src/robot/utils/robotpath.py
 /utest/utils/test_robotpath.py

=======================================
--- /src/robot/utils/robotpath.py       Wed Dec  5 06:39:07 2012
+++ /src/robot/utils/robotpath.py       Fri Dec 14 01:37:16 2012
@@ -64,12 +64,13 @@

     Rationale: os.path.relpath is not available before Python 2.6
     """
-    pathname =  _get_pathname(target, base)
-    url = urllib.pathname2url(pathname.encode('UTF-8'))
-    if os.path.isabs(pathname):
-        pre = url.startswith('/') and 'file:' or 'file:///'
-        url = pre + url
-    # Want consistent url on all platforms/interpreters
+    path =  _get_pathname(target, base)
+    url = urllib.pathname2url(path.encode('UTF-8'))
+    if os.path.isabs(path):
+        url = 'file:' + url
+    # At least Jython seems to use 'C|/Path' and not 'C:/Path'
+    if os.sep == '\\' and '|/' in url:
+        url = url.replace('|/', ':/', 1)
     return url.replace('%5C', '/').replace('%3A', ':').replace('|', ':')

 def _get_pathname(target, base):
=======================================
--- /utest/utils/test_robotpath.py      Wed Dec  5 06:39:07 2012
+++ /utest/utils/test_robotpath.py      Fri Dec 14 01:37:16 2012
@@ -76,22 +76,19 @@
 class TestGetLinkPath(unittest.TestCase):

     def test_get_link_path(self):
-        for basedir, target, expected in self._get_link_path_inputs():
+ inputs = self._posix_inputs if os.sep == '/' else self._windows_inputs
+        for basedir, target, expected in inputs():
assert_equal(get_link_path(target, basedir).replace('R:', 'r:'),
                          expected, '%s -> %s' % (target, basedir))

     def test_get_link_path_to_non_existing_path(self):
- assert_equal(get_link_path('/non_existing/foo.txt', '/non_existing/does_not_exist_never.txt'), '../foo.txt') + assert_equal(get_link_path('/non-ex/foo.txt', '/non-ex/nothing_here.txt'),
+                     '../foo.txt')

-    def test_get_link_path_with_unicode(self):
+    def test_get_non_ascii_link_path(self):
assert_equal(get_link_path(u'\xe4\xf6.txt', ''), '%C3%A4%C3%B6.txt')

-    def _get_link_path_inputs(self):
-        if os.sep == '/':
-            return self._get_link_path_inputs_for_posix()
-        return self._get_link_path_inputs_for_windows()
-
-    def _get_link_path_inputs_for_posix(self):
+    def _posix_inputs(self):
         return [('/tmp/', '/tmp/bar.txt', 'bar.txt'),
                 ('/tmp', '/tmp/x/bar.txt', 'x/bar.txt'),
                 ('/tmp/', '/tmp/x/y/bar.txt', 'x/y/bar.txt'),
@@ -115,7 +112,7 @@
                  '../path/to/existing/file'),
                 ('/path/to/identity', '/path/to/identity', 'identity')]

-    def _get_link_path_inputs_for_windows(self):
+    def _windows_inputs(self):
         return [('c:\\temp\\', 'c:\\temp\\bar.txt', 'bar.txt'),
                 ('c:\\temp', 'c:\\temp\\x\\bar.txt', 'x/bar.txt'),
                 ('c:\\temp\\', 'c:\\temp\\x\\y\\bar.txt', 'x/y/bar.txt'),
@@ -140,3 +137,7 @@
                  'c:\\windows\\path\\to\\existing\\file',
                  'path/to/existing/file'),
('c:\\path\\2\\identity', 'c:\\path\\2\\identity', 'identity')]
+
+
+if __name__ == '__main__':
+    unittest.main()

==============================================================================
Revision: bb70314743a4
Branch:   default
Author:   Pekka Klärck
Date:     Fri Dec 14 01:53:50 2012
Log: Clean-up: Comment is a comment, not a setting (i.e. moved Comment class from setting module to comment)
http://code.google.com/p/robotframework/source/detail?r=bb70314743a4

Modified:
 /src/robot/parsing/comments.py
 /src/robot/parsing/model.py
 /src/robot/parsing/settings.py

=======================================
--- /src/robot/parsing/comments.py      Wed Aug 29 03:17:56 2012
+++ /src/robot/parsing/comments.py      Fri Dec 14 01:53:50 2012
@@ -38,3 +38,22 @@
     @property
     def value(self):
         return self._comments
+
+
+class Comment(object):
+
+    def __init__(self, comment_data):
+        if isinstance(comment_data, basestring):
+            comment_data = [comment_data] if comment_data else []
+        self._comment = comment_data or []
+
+    def __len__(self):
+        return len(self._comment)
+
+    def as_list(self):
+        if self._has_comment():
+            self._comment[0] = '# ' + self._comment[0]
+        return self._comment
+
+    def _has_comment(self):
+ return self._comment and self._comment[0] and self._comment[0][0] != '#'
=======================================
--- /src/robot/parsing/model.py Wed Aug 29 05:50:26 2012
+++ /src/robot/parsing/model.py Fri Dec 14 01:53:50 2012
@@ -21,10 +21,10 @@
 from robot import utils
 from robot.writer import DataFileWriter

-from settings import (Documentation, Fixture, Timeout, Tags, Metadata,
-    Library, Resource, Variables, Arguments, Return, Template, Comment,
-    MetadataList, ImportList)
-from populators import FromFilePopulator, FromDirectoryPopulator
+from .comments import Comment
+from .populators import FromFilePopulator, FromDirectoryPopulator
+from .settings import (Documentation, Fixture, Timeout, Tags, Metadata, Library, + Resource, Variables, Arguments, Return, Template, MetadataList, ImportList)


 def TestData(parent=None, source=None, include_suites=[],
=======================================
--- /src/robot/parsing/settings.py      Mon Sep  3 13:22:35 2012
+++ /src/robot/parsing/settings.py      Fri Dec 14 01:53:50 2012
@@ -12,6 +12,8 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.

+from .comments import Comment
+

 class Setting(object):

@@ -275,25 +277,6 @@
         _Import.__init__(self, parent, name, args, comment=comment)


-class Comment(object):
-
-    def __init__(self, comment_data):
-        if isinstance(comment_data, basestring):
-            comment_data = [comment_data] if comment_data else []
-        self._comment = comment_data or []
-
-    def __len__(self):
-        return len(self._comment)
-
-    def as_list(self):
-        if self._has_comment():
-            self._comment[0] = '# ' + self._comment[0]
-        return self._comment
-
-    def _has_comment(self):
- return self._comment and self._comment[0] and self._comment[0][0] != '#'
-
-
 class _DataList(object):

     def __init__(self, parent):

Reply via email to