Merge lp:~verterok/ubuntuone-client/fix-440133 into lp:ubuntuone-client

Proposed by Guillermo Gonzalez
Status: Merged
Approved by: Guillermo Gonzalez
Approved revision: 236
Merged at revision: not available
Proposed branch: lp:~verterok/ubuntuone-client/fix-440133
Merge into: lp:ubuntuone-client
Diff against target: 75 lines
2 files modified
bin/ubuntuone-syncdaemon (+4/-0)
tests/syncdaemon/test_fsm.py (+43/-0)
To merge this branch: bzr merge lp:~verterok/ubuntuone-client/fix-440133
Reviewer Review Type Date Requested Status
Nicola Larosa (community) Approve
Tim Cole (community) Approve
Review via email: mp+12919@code.launchpad.net

Commit message

Fix Bug #440133 and add tests for EnableShareWrite context manager

To post a comment you must log in.
Revision history for this message
Guillermo Gonzalez (verterok) wrote :

Fix Bug #440133 and add tests for EnableShareWrite context manager

Revision history for this message
Tim Cole (tcole) wrote :

Looks reasonable.

review: Approve
Revision history for this message
Nicola Larosa (teknico) wrote :

Yes, nice, apart from some too long lines, but pylint does not work on the client code anyway, does it?

review: Approve
Revision history for this message
dobey (dobey) wrote :
Download full text (7.5 KiB)

The attempt to merge lp:~verterok/ubuntuone-client/fix-440133 into lp:ubuntuone-client failed.Below is the output from the failed tests.

/usr/bin/gnome-autogen.sh
checking for autoconf >= 2.53...
(B testing autoconf2.50... not found.
  testing autoconf... found 2.64
checking for automake >= 1.10...
(B testing automake-1.11... found 1.11
checking for libtool >= 1.5...
(B testing libtoolize... found 2.2.6
checking for intltool >= 0.30...
(B testing intltoolize... found 0.41.0
checking for pkg-config >= 0.14.0...
(B testing pkg-config... found 0.22
Checking for required M4 macros...
(BChecking for forbidden M4 macros...
(BProcessing ./configure.ac
(BRunning libtoolize...
(Blibtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
Running intltoolize...
(BRunning aclocal-1.11...
(BRunning autoconf...
(BRunning autoheader...
(BRunning automake-1.11...
(BRunning ./configure --enable-maintainer-mode --prefix=/usr ...
(Bchecking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for library containing strerror... none required
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) gcc3
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload obje...

Read more...

237. By Guillermo Gonzalez

remove unused import

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/ubuntuone-syncdaemon'
--- bin/ubuntuone-syncdaemon 2009-09-30 16:30:21 +0000
+++ bin/ubuntuone-syncdaemon 2009-10-07 15:21:11 +0000
@@ -147,6 +147,10 @@
147 os.makedirs(parent)147 os.makedirs(parent)
148 shutil.move(old_data_dir, options.data_dir)148 shutil.move(old_data_dir, options.data_dir)
149 if not os.path.exists(options.data_dir):149 if not os.path.exists(options.data_dir):
150 parent = os.path.dirname(options.data_dir)
151 if os.path.exists(parent) and not os.access(parent, os.W_OK):
152 # make the parent dir writable
153 os.chmod(parent, 0775)
150 os.makedirs(options.data_dir)154 os.makedirs(options.data_dir)
151155
152 # create the partials_dir156 # create the partials_dir
153157
=== modified file 'tests/syncdaemon/test_fsm.py'
--- tests/syncdaemon/test_fsm.py 2009-09-22 15:19:25 +0000
+++ tests/syncdaemon/test_fsm.py 2009-10-07 15:21:11 +0000
@@ -29,6 +29,7 @@
29)29)
3030
31from ubuntuone.syncdaemon.filesystem_manager import (31from ubuntuone.syncdaemon.filesystem_manager import (
32 EnableShareWrite,
32 FileSystemManager,33 FileSystemManager,
33 InconsistencyError,34 InconsistencyError,
34 METADATA_VERSION,35 METADATA_VERSION,
@@ -2230,6 +2231,48 @@
2230 self.assertTrue(os.path.exists(self.fsm.get_abspath("", a_dir_root)))2231 self.assertTrue(os.path.exists(self.fsm.get_abspath("", a_dir_root)))
2231 self.assertTrue(os.path.exists(a_dir_share))2232 self.assertTrue(os.path.exists(a_dir_share))
22322233
2234
2235class TestEnableShareWrite(FSMTestCase):
2236 """Tests for EnableShareWrite context manager"""
2237
2238 def setUp(self):
2239 """Test setup"""
2240 FSMTestCase.setUp(self)
2241 # create a ro share
2242 self.share_ro = self.create_share('share_ro', 'share_ro_name',
2243 self.fsm, self.shares_dir, access_level='View')
2244 self.share_ro_path = self.share_ro.path
2245
2246 def test_write_in_ro_share(self):
2247 """test the EnableShareWrite context manager in a ro share"""
2248 path = os.path.join(self.share_ro_path, 'foo', 'a_file_in_a_ro_share')
2249 data = 'yes I can write!'
2250 can_write_parent = os.access(os.path.dirname(self.share_ro_path), os.W_OK)
2251 with EnableShareWrite(self.share_ro, path):
2252 with open(path, 'w') as f:
2253 f.write(data)
2254 self.assertEquals(data, open(path, 'r').read())
2255 self.assertFalse(os.access(self.share_ro_path, os.W_OK))
2256 # check that the parent permissions are ok
2257 self.assertEquals(can_write_parent, os.access(os.path.dirname(self.share_ro_path), os.W_OK))
2258 # fail to write directly in the share
2259 self.assertRaises(IOError, open, path, 'w')
2260
2261
2262 def test_write_in_rw_share(self):
2263 """test the EnableShareWrite context manager in a rw share"""
2264 path = os.path.join(self.share_path, 'a_file_in_a_rw_share')
2265 data = 'yes I can write!'
2266 can_write_parent = os.access(os.path.dirname(self.share_path), os.W_OK)
2267 with EnableShareWrite(self.share, path):
2268 with open(path, 'w') as f:
2269 f.write(data)
2270 self.assertEquals(data, open(path, 'r').read())
2271 self.assertTrue(os.access(self.share_path, os.W_OK))
2272 # check that the parent permissions are ok
2273 self.assertEquals(can_write_parent, os.access(self.share_path, os.W_OK))
2274
2275
2233def test_suite():2276def test_suite():
2234 # pylint: disable-msg=C01112277 # pylint: disable-msg=C0111
2235 return unittest.TestLoader().loadTestsFromName(__name__)2278 return unittest.TestLoader().loadTestsFromName(__name__)

Subscribers

People subscribed via source and target branches