Merge lp:~brian.curtin/ubuntuone-control-panel/windows-symlink into lp:ubuntuone-control-panel

Proposed by Brian Curtin on 2012-03-23
Status: Merged
Approved by: Natalia Bidart on 2012-03-23
Approved revision: 297
Merged at revision: 297
Proposed branch: lp:~brian.curtin/ubuntuone-control-panel/windows-symlink
Merge into: lp:ubuntuone-control-panel
Diff against target: 50 lines (+23/-4)
1 file modified
ubuntuone/controlpanel/gui/qt/tests/test_folders.py (+23/-4)
To merge this branch: bzr merge lp:~brian.curtin/ubuntuone-control-panel/windows-symlink
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve on 2012-03-23
Natalia Bidart 2012-03-23 Approve on 2012-03-23
Review via email: mp+99017@code.launchpad.net

Commit Message

- Made the creation of symlinks a separated test case so it can be skipped on Windows.

Description of the Change

Add a platform check before trying to use os.symlink on Windows.

This is a clean version of https://code.launchpad.net/~brian.curtin/ubuntuone-control-panel/no-symlinks-on-windows/+merge/98736 which got polluted with several other changes.

To post a comment you must log in.
Natalia Bidart (nataliabidart) wrote :

Looks great!

review: Approve
Roberto Alsina (ralsina) wrote :

+1

review: Approve
Ubuntu One Auto Pilot (otto-pilot) wrote :
Download full text (136.1 KiB)

The attempt to merge lp:~brian.curtin/ubuntuone-control-panel/windows-symlink into lp:ubuntuone-control-panel failed. Below is the output from the failed tests.

*** Running test suite for ubuntuone/controlpanel ***
ubuntuone.controlpanel.utils.tests.test_utils
  ExceptionHandlingTestCase
    test_exception_to_error_dict ... [OK]
    test_failure_to_error_dict ... [OK]
  GetDataFileTestCase
    test_get_data_file ... [OK]
  GetProjectDirTestCase
    test_get_project_dir_none_exists ... [OK]
    test_get_project_dir_relative ... [OK]
  GetProjectDirWithConstantsTestCase
    test_get_project_dir ... [OK]
    test_get_project_dir_none_exists ... [OK]
    test_get_project_dir_relative ... [OK]
ubuntuone.controlpanel.tests
  TestCase
    runTest ... [OK]
ubuntuone.controlpanel.utils.tests.test_linux
  AutoupdaterTestCase
    test_are_updates_present ... [OK]
    test_perform_update ... [OK]
  DefaultFoldersTestCase
    test_default_folders_bad_encoding ... [OK]
    test_default_folders_empty_file ... [OK]
    test_default_folders_non_ascii ... [OK]
    test_default_folders_not_file ... [OK]
    test_default_folders_only_comments ... [OK]
    test_default_folders_parsed ... [OK]
    test_default_folders_syntax_error ... [OK]
ubuntuone.controlpanel.tests
  TestCase
    runTest ... [OK]
ubuntuone.controlpanel.tests.test_replication_client
  ReplicationsTestCase
    test_exclude ... [OK]
    test_exclude_name_in_exclusions ... [OK]
    test_exclude_name_not_in_replications ... [OK]
    test_get_exclusions ... [OK]
    test_get_replications ... [OK]
    test_no_pairing_record ... [OK]
    test_replicate ... [OK]
    test_replicate_name_not_in_exclusions ... [OK]
    test_replicate_name_not_in_replications ... [OK]
ubuntuone.controlpanel.tests
  TestCase
    runTest ... [OK]
ubuntuone.controlpanel.tests.test_sd_client
  AutoconnectTestCase
    test_disable ... [OK]
    test_disable_throws_an_error ... ...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_folders.py'
2--- ubuntuone/controlpanel/gui/qt/tests/test_folders.py 2012-03-19 20:51:26 +0000
3+++ ubuntuone/controlpanel/gui/qt/tests/test_folders.py 2012-03-23 14:10:24 +0000
4@@ -26,6 +26,7 @@
5 from PyQt4 import QtGui
6 from twisted.internet import defer
7 from ubuntuone.devtools.handlers import MementoHandler
8+from ubuntuone.devtools.testcases import skipIfOS
9
10 from ubuntuone.controlpanel.tests import helper_fail
11 from ubuntuone.controlpanel.gui.tests import (
12@@ -694,10 +695,6 @@
13 empty_dir = os.path.join(dir_path, 'empty')
14 os.mkdir(empty_dir)
15
16- # add a symlink to confirm those are avoided
17- a_link = os.path.join(dir_path, 'some_link')
18- os.symlink(a_file, a_link)
19-
20 return total_size
21
22
23@@ -733,6 +730,28 @@
24 self.assertRaises(Queue.Empty, self.queue.get, block=True, timeout=0.5)
25
26
27+@skipIfOS("win32", "Windows does not easily support symlinks")
28+class CalculateSizeWithSymlinksTestCase(BaseLocalFoldersTestCase):
29+ """Test suite for the CalculateSize thread implementation."""
30+
31+ def build_test_dir(self, dir_path):
32+ """Build a testing directory hierarchy."""
33+ total_size = super(CalculateSizeWithSymlinksTestCase,
34+ self).build_test_dir(dir_path)
35+
36+ a_file = os.path.join(dir_path, 'to_be_symlinked')
37+ with open(a_file, 'wb') as f:
38+ f.write('y' * 5000)
39+
40+ total_size += os.path.getsize(a_file)
41+
42+ # add a symlink to confirm those are avoided
43+ a_link = os.path.join(dir_path, 'some_link')
44+ os.symlink(a_file, a_link)
45+
46+ return total_size
47+
48+
49 class FakedCalculateSize(object):
50 """A faked CalculateSize thread."""
51

Subscribers

People subscribed via source and target branches