Revision: 2b70dd1b0b20
Author:   Jussi Malinen
Date:     Tue Jul 26 05:04:16 2011
Log: Fixed a relative link path bug from log. get_link_path needs to be given a directory path, never the entire log path. (as specified by the api documentation). Added also unit tests to verify this.
http://code.google.com/p/robotframework/source/detail?r=2b70dd1b0b20

Modified:
 /src/robot/result/parsingcontext.py
 /utest/result/test_js_serializer.py
 /utest/utils/test_robotpath.py

=======================================
--- /src/robot/result/parsingcontext.py Fri Jul 22 03:20:32 2011
+++ /src/robot/result/parsingcontext.py Tue Jul 26 05:04:16 2011
@@ -34,7 +34,7 @@

     def get_rel_log_path(self, path):
         if path and os.path.exists(path) and self._log_path != 'NONE':
-            return utils.get_link_path(path, self._log_path)
+ return utils.get_link_path(path, os.path.dirname(self._log_path))
         return ''

     def get_id(self, value):
=======================================
--- /utest/result/test_js_serializer.py Thu Jul 21 04:26:46 2011
+++ /utest/result/test_js_serializer.py Tue Jul 26 05:04:16 2011
@@ -587,9 +587,9 @@
         self._test_rel_path(log='NONE', expected='')

     def test_log_path(self):
-        self._test_rel_path(log='/tmp', expected='supersimple.txt')
- self._test_rel_path(log='/tmp/kekko', expected='../supersimple.txt')
-        self._test_rel_path(log='/home', expected='../tmp/supersimple.txt')
+ self._test_rel_path(log='/tmp/non_existing_log.html', expected='supersimple.txt') + self._test_rel_path(log='/tmp/kekko/non_existing_log.html', expected='../supersimple.txt') + self._test_rel_path(log='/home/non_existing_log.html', expected='../tmp/supersimple.txt')

     def test_no_source(self):
         os.path.exists = lambda path: False
=======================================
--- /utest/utils/test_robotpath.py      Fri Apr 15 14:27:57 2011
+++ /utest/utils/test_robotpath.py      Tue Jul 26 05:04:16 2011
@@ -66,6 +66,9 @@
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')
+
     def test_get_link_path_with_unicode(self):
assert_equal(get_link_path(u'\xe4\xf6.txt', ''), '%C3%A4%C3%B6.txt')

Reply via email to