Merge lp:~nataliabidart/ubuntuone-client/no-more-oses into lp:ubuntuone-client

Proposed by Natalia Bidart
Status: Merged
Approved by: Natalia Bidart
Approved revision: 1099
Merged at revision: 1097
Proposed branch: lp:~nataliabidart/ubuntuone-client/no-more-oses
Merge into: lp:ubuntuone-client
Prerequisite: lp:~nataliabidart/ubuntuone-client/unify-os-helper-tests
Diff against target: 2026 lines (+321/-273)
18 files modified
tests/platform/test_filesystem_notifications.py (+9/-8)
tests/platform/test_os_helper.py (+8/-8)
tests/syncdaemon/test_action_queue.py (+4/-4)
tests/syncdaemon/test_config.py (+10/-9)
tests/syncdaemon/test_eq_inotify.py (+96/-85)
tests/syncdaemon/test_fsm.py (+93/-83)
tests/syncdaemon/test_localrescan.py (+8/-8)
tests/syncdaemon/test_main.py (+27/-22)
tests/syncdaemon/test_sync.py (+4/-3)
tests/syncdaemon/test_vm.py (+14/-9)
ubuntuone/platform/linux/filesystem_notifications.py (+4/-3)
ubuntuone/platform/windows/filesystem_notifications.py (+4/-2)
ubuntuone/syncdaemon/file_shelf.py (+12/-3)
ubuntuone/syncdaemon/filesystem_manager.py (+1/-1)
ubuntuone/syncdaemon/filesystem_notifications.py (+2/-1)
ubuntuone/syncdaemon/local_rescan.py (+1/-1)
ubuntuone/syncdaemon/vm_helper.py (+2/-1)
ubuntuone/syncdaemon/volume_manager.py (+22/-22)
To merge this branch: bzr merge lp:~nataliabidart/ubuntuone-client/no-more-oses
Reviewer Review Type Date Requested Status
Alejandro J. Cura (community) Approve
Review via email: mp+70890@code.launchpad.net

Commit message

- Removed most of the calls to: os.rename, os.chmod, os.path.exists, os.remove and os.rmdir (LP: #823261).

To post a comment you must log in.
1099. By Natalia Bidart

Changes from dependency branch.

Revision history for this message
Alejandro J. Cura (alecu) wrote :

Great branch

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/platform/test_filesystem_notifications.py'
--- tests/platform/test_filesystem_notifications.py 2011-06-24 19:48:00 +0000
+++ tests/platform/test_filesystem_notifications.py 2011-08-09 16:37:30 +0000
@@ -23,12 +23,13 @@
23import unittest23import unittest
2424
25from twisted.internet import defer, reactor25from twisted.internet import defer, reactor
26from ubuntuone.devtools.handlers import MementoHandler
27from ubuntuone.devtools.testcase import skipIfOS
2628
27from tests.platform import _GeneralINotifyProcessor29from tests.platform import _GeneralINotifyProcessor
28from contrib.testing import testcase30from contrib.testing import testcase
31from ubuntuone.platform import remove_file, remove_dir, rename
29from ubuntuone.syncdaemon.tritcask import Tritcask32from ubuntuone.syncdaemon.tritcask import Tritcask
30from ubuntuone.devtools.handlers import MementoHandler
31from ubuntuone.devtools.testcase import skipIfOS
32from ubuntuone.syncdaemon import (33from ubuntuone.syncdaemon import (
33 event_queue,34 event_queue,
34 filesystem_manager,35 filesystem_manager,
@@ -315,7 +316,7 @@
315 yield self.monitor.add_watch(self.root_dir)316 yield self.monitor.add_watch(self.root_dir)
316317
317 # generate the event318 # generate the event
318 os.remove(testfile)319 remove_file(testfile)
319 reactor.callLater(self.timeout - 0.2, self.check_filter)320 reactor.callLater(self.timeout - 0.2, self.check_filter)
320 test_result = yield self._deferred321 test_result = yield self._deferred
321 defer.returnValue(test_result)322 defer.returnValue(test_result)
@@ -330,7 +331,7 @@
330 yield self.monitor.add_watch(self.root_dir)331 yield self.monitor.add_watch(self.root_dir)
331332
332 # generate the event333 # generate the event
333 os.rmdir(testdir)334 remove_dir(testdir)
334 reactor.callLater(self.timeout - 0.2, self.check_filter)335 reactor.callLater(self.timeout - 0.2, self.check_filter)
335 test_result = yield self._deferred336 test_result = yield self._deferred
336 defer.returnValue(test_result)337 defer.returnValue(test_result)
@@ -351,7 +352,7 @@
351 yield self.monitor.add_watch(self.root_dir)352 yield self.monitor.add_watch(self.root_dir)
352353
353 # generate the event354 # generate the event
354 os.rename(fromfile, tofile)355 rename(fromfile, tofile)
355 reactor.callLater(self.timeout - 0.2, self.check_filter)356 reactor.callLater(self.timeout - 0.2, self.check_filter)
356 test_result = yield self._deferred357 test_result = yield self._deferred
357 defer.returnValue(test_result)358 defer.returnValue(test_result)
@@ -372,7 +373,7 @@
372 yield self.monitor.add_watch(self.root_dir)373 yield self.monitor.add_watch(self.root_dir)
373374
374 # generate the event375 # generate the event
375 os.rename(fromdir, todir)376 rename(fromdir, todir)
376 reactor.callLater(self.timeout - 0.2, self.check_filter)377 reactor.callLater(self.timeout - 0.2, self.check_filter)
377 test_result = yield self._deferred378 test_result = yield self._deferred
378 defer.returnValue(test_result)379 defer.returnValue(test_result)
@@ -393,7 +394,7 @@
393 yield self.monitor.add_watch(self.root_dir)394 yield self.monitor.add_watch(self.root_dir)
394395
395 # generate the event396 # generate the event
396 os.rename(fromfile, tofile)397 rename(fromfile, tofile)
397 reactor.callLater(self.timeout - 0.2, self.check_filter)398 reactor.callLater(self.timeout - 0.2, self.check_filter)
398 test_result = yield self._deferred399 test_result = yield self._deferred
399 defer.returnValue(test_result)400 defer.returnValue(test_result)
@@ -412,7 +413,7 @@
412 yield self.monitor.add_watch(root_dir)413 yield self.monitor.add_watch(root_dir)
413414
414 # generate the event415 # generate the event
415 os.rename(fromfile, tofile)416 rename(fromfile, tofile)
416 reactor.callLater(self.timeout - 0.2, self.check_filter)417 reactor.callLater(self.timeout - 0.2, self.check_filter)
417 test_result = yield self._deferred418 test_result = yield self._deferred
418 defer.returnValue(test_result)419 defer.returnValue(test_result)
419420
=== modified file 'tests/platform/test_os_helper.py'
--- tests/platform/test_os_helper.py 2011-08-09 16:37:30 +0000
+++ tests/platform/test_os_helper.py 2011-08-09 16:37:30 +0000
@@ -84,7 +84,7 @@
84 set_dir_readwrite(self.basedir)84 set_dir_readwrite(self.basedir)
85 foo_dir = os.path.join(self.basedir, 'foo')85 foo_dir = os.path.join(self.basedir, 'foo')
86 os.mkdir(foo_dir)86 os.mkdir(foo_dir)
87 self.assertTrue(os.path.exists(foo_dir))87 self.assertTrue(path_exists(foo_dir))
8888
89 def test_allow_writes(self):89 def test_allow_writes(self):
90 """Test for allow_writes."""90 """Test for allow_writes."""
@@ -92,7 +92,7 @@
92 with allow_writes(self.basedir):92 with allow_writes(self.basedir):
93 foo_dir = os.path.join(self.basedir, 'foo')93 foo_dir = os.path.join(self.basedir, 'foo')
94 os.mkdir(foo_dir)94 os.mkdir(foo_dir)
95 self.assertTrue(os.path.exists(foo_dir))95 self.assertTrue(path_exists(foo_dir))
9696
97 def test_set_file_readonly(self):97 def test_set_file_readonly(self):
98 """Test for set_file_readonly."""98 """Test for set_file_readonly."""
@@ -135,16 +135,16 @@
135 """Test the remove dir."""135 """Test the remove dir."""
136 testdir = os.path.join(self.basedir, 'foodir')136 testdir = os.path.join(self.basedir, 'foodir')
137 os.mkdir(testdir)137 os.mkdir(testdir)
138 assert os.path.exists(testdir)138 assert path_exists(testdir)
139 remove_dir(testdir)139 remove_dir(testdir)
140 self.assertFalse(path_exists(testdir))140 self.assertFalse(path_exists(testdir))
141141
142 def test_make_dir_one(self):142 def test_make_dir_one(self):
143 """Test the make dir with one dir."""143 """Test the make dir with one dir."""
144 testdir = os.path.join(self.basedir, 'foodir')144 testdir = os.path.join(self.basedir, 'foodir')
145 assert not os.path.exists(testdir)145 assert not path_exists(testdir)
146 make_dir(testdir)146 make_dir(testdir)
147 self.assertTrue(os.path.exists(testdir))147 self.assertTrue(path_exists(testdir))
148148
149 def test_make_dir_already_there(self):149 def test_make_dir_already_there(self):
150 """Test the make dir with one dir that exists."""150 """Test the make dir with one dir that exists."""
@@ -153,15 +153,15 @@
153 def test_make_dir_recursive_no(self):153 def test_make_dir_recursive_no(self):
154 """Test the make dir with some dirs, not recursive explicit."""154 """Test the make dir with some dirs, not recursive explicit."""
155 testdir = os.path.join(self.basedir, 'foo', 'bar')155 testdir = os.path.join(self.basedir, 'foo', 'bar')
156 assert not os.path.exists(testdir)156 assert not path_exists(testdir)
157 self.assertRaises(OSError, make_dir, testdir)157 self.assertRaises(OSError, make_dir, testdir)
158158
159 def test_make_dir_recursive_yes(self):159 def test_make_dir_recursive_yes(self):
160 """Test the make dir with some dirs, recursive."""160 """Test the make dir with some dirs, recursive."""
161 testdir = os.path.join(self.basedir, 'foo', 'bar')161 testdir = os.path.join(self.basedir, 'foo', 'bar')
162 assert not os.path.exists(testdir)162 assert not path_exists(testdir)
163 make_dir(testdir, recursive=True)163 make_dir(testdir, recursive=True)
164 self.assertTrue(os.path.exists(testdir))164 self.assertTrue(path_exists(testdir))
165165
166 def test_open_file_not_there(self):166 def test_open_file_not_there(self):
167 """Open a file that does not exist."""167 """Open a file that does not exist."""
168168
=== modified file 'tests/syncdaemon/test_action_queue.py'
--- tests/syncdaemon/test_action_queue.py 2011-08-08 19:54:46 +0000
+++ tests/syncdaemon/test_action_queue.py 2011-08-09 16:37:30 +0000
@@ -31,9 +31,9 @@
31import uuid31import uuid
3232
33from functools import wraps33from functools import wraps
34from StringIO import StringIO
3435
35from mocker import Mocker, MockerTestCase, ANY, expect36from mocker import Mocker, MockerTestCase, ANY, expect
36from StringIO import StringIO
37from oauth import oauth37from oauth import oauth
38from twisted.internet import defer, threads, reactor38from twisted.internet import defer, threads, reactor
39from twisted.internet import error as twisted_error39from twisted.internet import error as twisted_error
@@ -47,7 +47,7 @@
47)47)
48from ubuntuone.devtools import handlers48from ubuntuone.devtools import handlers
49from ubuntuone import logger, clientdefs49from ubuntuone import logger, clientdefs
50from ubuntuone.platform import platform50from ubuntuone.platform import platform, path_exists
51from ubuntuone.storageprotocol import (51from ubuntuone.storageprotocol import (
52 client,52 client,
53 content_hash,53 content_hash,
@@ -3316,12 +3316,12 @@
3316 self.command.tempfile = TempFile()3316 self.command.tempfile = TempFile()
3317 self.command.tempfile.name = os.path.join(self.tmpdir, 'remove-me.zip')3317 self.command.tempfile.name = os.path.join(self.tmpdir, 'remove-me.zip')
3318 open(self.command.tempfile.name, 'w').close()3318 open(self.command.tempfile.name, 'w').close()
3319 assert os.path.exists(self.command.tempfile.name)3319 assert path_exists(self.command.tempfile.name)
33203320
3321 msg = 'Something went wrong'3321 msg = 'Something went wrong'
3322 failure = Failure(DefaultException(msg))3322 failure = Failure(DefaultException(msg))
3323 self.command.handle_failure(failure=failure)3323 self.command.handle_failure(failure=failure)
3324 self.assertFalse(os.path.exists(self.command.tempfile.name))3324 self.assertFalse(path_exists(self.command.tempfile.name))
33253325
3326 def test_retryable_failure_push_quota_exceeded_if_that_error(self):3326 def test_retryable_failure_push_quota_exceeded_if_that_error(self):
3327 """Test SYS_QUOTA_EXCEEDED is pushed on QuotaExceededError."""3327 """Test SYS_QUOTA_EXCEEDED is pushed on QuotaExceededError."""
33283328
=== modified file 'tests/syncdaemon/test_config.py'
--- tests/syncdaemon/test_config.py 2011-07-29 12:51:04 +0000
+++ tests/syncdaemon/test_config.py 2011-08-09 16:37:30 +0000
@@ -23,6 +23,7 @@
23from ConfigParser import ConfigParser23from ConfigParser import ConfigParser
24from twisted.internet import defer24from twisted.internet import defer
2525
26from ubuntuone.platform import path_exists
26from ubuntuone.platform.xdg_base_directory import (27from ubuntuone.platform.xdg_base_directory import (
27 xdg_data_home,28 xdg_data_home,
28 xdg_cache_home,29 xdg_cache_home,
@@ -103,7 +104,7 @@
103 def test_write_new(self):104 def test_write_new(self):
104 """test writing the throttling section to a new config file"""105 """test writing the throttling section to a new config file"""
105 conf_file = os.path.join(self.test_root, 'test_write_new_config.conf')106 conf_file = os.path.join(self.test_root, 'test_write_new_config.conf')
106 self.assertFalse(os.path.exists(conf_file))107 self.assertFalse(path_exists(conf_file))
107 conf = config._Config(conf_file)108 conf = config._Config(conf_file)
108 conf.set_throttling(True)109 conf.set_throttling(True)
109 conf.set_throttling_read_limit(1000)110 conf.set_throttling_read_limit(1000)
@@ -124,7 +125,7 @@
124 fp.write('on = False\n')125 fp.write('on = False\n')
125 fp.write('read_limit = 1000\n')126 fp.write('read_limit = 1000\n')
126 fp.write('write_limit = 100\n')127 fp.write('write_limit = 100\n')
127 self.assertTrue(os.path.exists(conf_file))128 self.assertTrue(path_exists(conf_file))
128 conf = config._Config(conf_file)129 conf = config._Config(conf_file)
129 conf.set_throttling(True)130 conf.set_throttling(True)
130 conf.set_throttling_read_limit(2000)131 conf.set_throttling_read_limit(2000)
@@ -150,7 +151,7 @@
150 fp.write('on = False\n')151 fp.write('on = False\n')
151 fp.write('read_limit = 2000\n')152 fp.write('read_limit = 2000\n')
152 fp.write('write_limit = 200\n')153 fp.write('write_limit = 200\n')
153 self.assertTrue(os.path.exists(conf_file))154 self.assertTrue(path_exists(conf_file))
154 conf = config._Config(conf_file)155 conf = config._Config(conf_file)
155 conf.set_throttling(True)156 conf.set_throttling(True)
156 conf.set_throttling_read_limit(3000)157 conf.set_throttling_read_limit(3000)
@@ -177,7 +178,7 @@
177 fp.write('on = True\n')178 fp.write('on = True\n')
178 fp.write('read_limit = 1000\n')179 fp.write('read_limit = 1000\n')
179 fp.write('write_limit = 100\n')180 fp.write('write_limit = 100\n')
180 self.assertTrue(os.path.exists(conf_file))181 self.assertTrue(path_exists(conf_file))
181 conf = config._Config(conf_file)182 conf = config._Config(conf_file)
182 conf.set_throttling(False)183 conf.set_throttling(False)
183 conf.save()184 conf.save()
@@ -570,7 +571,7 @@
570 with open(conf_file, 'w') as fp:571 with open(conf_file, 'w') as fp:
571 fp.write('[__main__]\n')572 fp.write('[__main__]\n')
572 fp.write('log_level = DEBUG\n')573 fp.write('log_level = DEBUG\n')
573 self.assertTrue(os.path.exists(conf_file))574 self.assertTrue(path_exists(conf_file))
574 self.cp.read([conf_file])575 self.cp.read([conf_file])
575 self.cp.parse_all()576 self.cp.parse_all()
576 self.assertEquals(self.cp.get('logging', 'level').value, 10)577 self.assertEquals(self.cp.get('logging', 'level').value, 10)
@@ -582,7 +583,7 @@
582 with open(conf_file, 'w') as fp:583 with open(conf_file, 'w') as fp:
583 fp.write('[logging]\n')584 fp.write('[logging]\n')
584 fp.write('level = DEBUG\n')585 fp.write('level = DEBUG\n')
585 self.assertTrue(os.path.exists(conf_file))586 self.assertTrue(path_exists(conf_file))
586 self.cp.read([conf_file])587 self.cp.read([conf_file])
587 self.cp.parse_all()588 self.cp.parse_all()
588 self.assertEquals(self.cp.get('logging', 'level').value, 10)589 self.assertEquals(self.cp.get('logging', 'level').value, 10)
@@ -597,7 +598,7 @@
597 fp.write('log_level = NOTE\n')598 fp.write('log_level = NOTE\n')
598 fp.write('[logging]\n')599 fp.write('[logging]\n')
599 fp.write('level = ERROR\n')600 fp.write('level = ERROR\n')
600 self.assertTrue(os.path.exists(conf_file))601 self.assertTrue(path_exists(conf_file))
601 self.cp.read([conf_file])602 self.cp.read([conf_file])
602 self.cp.parse_all()603 self.cp.parse_all()
603 self.assertEquals(self.cp.get('logging', 'level').value, logging.ERROR)604 self.assertEquals(self.cp.get('logging', 'level').value, logging.ERROR)
@@ -634,7 +635,7 @@
634 with open(conf_file, 'w') as fp:635 with open(conf_file, 'w') as fp:
635 fp.write('[__main__]\n')636 fp.write('[__main__]\n')
636 fp.write('ignore = .*\\.pyc\n') # all .pyc files637 fp.write('ignore = .*\\.pyc\n') # all .pyc files
637 self.assertTrue(os.path.exists(conf_file))638 self.assertTrue(path_exists(conf_file))
638 self.cp.read([conf_file])639 self.cp.read([conf_file])
639 self.cp.parse_all()640 self.cp.parse_all()
640 self.assertEquals(self.cp.get('__main__', 'ignore').value,641 self.assertEquals(self.cp.get('__main__', 'ignore').value,
@@ -647,7 +648,7 @@
647 fp.write('[__main__]\n')648 fp.write('[__main__]\n')
648 fp.write('ignore = .*\\.pyc\n') # all .pyc files649 fp.write('ignore = .*\\.pyc\n') # all .pyc files
649 fp.write(' .*\\.sw[opnx]\n') # all gvim temp files650 fp.write(' .*\\.sw[opnx]\n') # all gvim temp files
650 self.assertTrue(os.path.exists(conf_file))651 self.assertTrue(path_exists(conf_file))
651 self.cp.read([conf_file])652 self.cp.read([conf_file])
652 self.cp.parse_all()653 self.cp.parse_all()
653 self.assertEquals(self.cp.get('__main__', 'ignore').value,654 self.assertEquals(self.cp.get('__main__', 'ignore').value,
654655
=== modified file 'tests/syncdaemon/test_eq_inotify.py'
--- tests/syncdaemon/test_eq_inotify.py 2011-08-04 16:30:54 +0000
+++ tests/syncdaemon/test_eq_inotify.py 2011-08-09 16:37:30 +0000
@@ -28,7 +28,18 @@
2828
29from contrib.testing.testcase import BaseTwistedTestCase, FakeMain, Listener29from contrib.testing.testcase import BaseTwistedTestCase, FakeMain, Listener
30from tests.syncdaemon.test_eventqueue import BaseEQTestCase30from tests.syncdaemon.test_eventqueue import BaseEQTestCase
31from ubuntuone.platform import make_dir, make_link, open_file, path_exists31from ubuntuone.platform import (
32 make_link,
33 make_dir,
34 open_file,
35 path_exists,
36 remove_file,
37 remove_dir,
38 rename,
39 set_no_rights,
40 set_file_readwrite,
41 set_dir_readwrite,
42)
32from ubuntuone.syncdaemon import volume_manager43from ubuntuone.syncdaemon import volume_manager
3344
34# our logging level45# our logging level
@@ -348,7 +359,7 @@
348 self.finished_error("received a wrong path")359 self.finished_error("received a wrong path")
349 else:360 else:
350 if innerself.hist == ["create"]:361 if innerself.hist == ["create"]:
351 os.remove(testfile)362 remove_file(testfile)
352 self.finished_ok()363 self.finished_ok()
353 else:364 else:
354 msg = "Finished in bad condition: %s" % innerself.hist365 msg = "Finished in bad condition: %s" % innerself.hist
@@ -448,7 +459,7 @@
448 self.eq.subscribe(DontHitMe(self))459 self.eq.subscribe(DontHitMe(self))
449460
450 # generate the event461 # generate the event
451 os.remove(testfile)462 remove_file(testfile)
452 reactor.callLater(.1, self._deferred.callback, True)463 reactor.callLater(.1, self._deferred.callback, True)
453 yield self._deferred464 yield self._deferred
454465
@@ -463,7 +474,7 @@
463 self.eq.subscribe(DontHitMe(self))474 self.eq.subscribe(DontHitMe(self))
464475
465 # generate the event476 # generate the event
466 os.rmdir(testdir)477 remove_dir(testdir)
467 reactor.callLater(.1, self._deferred.callback, True)478 reactor.callLater(.1, self._deferred.callback, True)
468 yield self._deferred479 yield self._deferred
469480
@@ -484,7 +495,7 @@
484 self.eq.subscribe(DontHitMe(self))495 self.eq.subscribe(DontHitMe(self))
485496
486 # generate the event497 # generate the event
487 os.rename(fromfile, tofile)498 rename(fromfile, tofile)
488 reactor.callLater(.1, self._deferred.callback, True)499 reactor.callLater(.1, self._deferred.callback, True)
489 yield self._deferred500 yield self._deferred
490501
@@ -505,7 +516,7 @@
505 self.eq.subscribe(DontHitMe(self))516 self.eq.subscribe(DontHitMe(self))
506517
507 # generate the event518 # generate the event
508 os.rename(fromdir, todir)519 rename(fromdir, todir)
509 reactor.callLater(.1, self._deferred.callback, True)520 reactor.callLater(.1, self._deferred.callback, True)
510 yield self._deferred521 yield self._deferred
511522
@@ -525,7 +536,7 @@
525 self.eq.subscribe(DontHitMe(self))536 self.eq.subscribe(DontHitMe(self))
526537
527 # generate the event538 # generate the event
528 os.rename(fromfile, tofile)539 rename(fromfile, tofile)
529 reactor.callLater(.1, self._deferred.callback, True)540 reactor.callLater(.1, self._deferred.callback, True)
530 yield self._deferred541 yield self._deferred
531542
@@ -544,7 +555,7 @@
544 self.eq.subscribe(DontHitMe(self))555 self.eq.subscribe(DontHitMe(self))
545556
546 # generate the event557 # generate the event
547 os.rename(fromfile, tofile)558 rename(fromfile, tofile)
548 reactor.callLater(.1, self._deferred.callback, True)559 reactor.callLater(.1, self._deferred.callback, True)
549 yield self._deferred560 yield self._deferred
550561
@@ -652,13 +663,13 @@
652 f.read()663 f.read()
653 f.close()664 f.close()
654 # generate FS_FILE_DELETE665 # generate FS_FILE_DELETE
655 os.remove(fname)666 remove_file(fname)
656667
657 fnamedir = os.path.join(path, 'testit.dir')668 fnamedir = os.path.join(path, 'testit.dir')
658 # generate FS_DIR_CREATE669 # generate FS_DIR_CREATE
659 os.mkdir(fnamedir)670 os.mkdir(fnamedir)
660 # generate FS_DIR_DELETE671 # generate FS_DIR_DELETE
661 os.rmdir(fnamedir)672 remove_dir(fnamedir)
662673
663 def check():674 def check():
664 """Check."""675 """Check."""
@@ -682,13 +693,13 @@
682 f.read()693 f.read()
683 f.close()694 f.close()
684 # generate FS_FILE_DELETE695 # generate FS_FILE_DELETE
685 os.remove(fname)696 remove_file(fname)
686697
687 fnamedir = os.path.join(path, 'testit.dir')698 fnamedir = os.path.join(path, 'testit.dir')
688 # generate FS_DIR_CREATE699 # generate FS_DIR_CREATE
689 os.mkdir(fnamedir)700 os.mkdir(fnamedir)
690 # generate FS_DIR_DELETE701 # generate FS_DIR_DELETE
691 os.rmdir(fnamedir)702 remove_dir(fnamedir)
692703
693 expected = [('FS_FILE_CREATE', {'path': fname}),704 expected = [('FS_FILE_CREATE', {'path': fname}),
694 ('FS_FILE_OPEN', {'path': fname}),705 ('FS_FILE_OPEN', {'path': fname}),
@@ -739,7 +750,7 @@
739 path = self.udf.ancestors[-2] # an ancestor common to both UDFs750 path = self.udf.ancestors[-2] # an ancestor common to both UDFs
740 # generate IN_MOVED_FROM and IN_MOVED_TO751 # generate IN_MOVED_FROM and IN_MOVED_TO
741 newpath = path + u'.old'752 newpath = path + u'.old'
742 os.rename(path, newpath)753 rename(path, newpath)
743 assert path_exists(newpath)754 assert path_exists(newpath)
744755
745 unsubscribed = []756 unsubscribed = []
@@ -774,7 +785,7 @@
774 """UDF is unsubscribed if renamed."""785 """UDF is unsubscribed if renamed."""
775 original = self.eq.fs.vm.unsubscribe_udf786 original = self.eq.fs.vm.unsubscribe_udf
776 newpath = self.udf.path + u'.old'787 newpath = self.udf.path + u'.old'
777 os.rename(self.udf.path, newpath)788 rename(self.udf.path, newpath)
778 assert path_exists(newpath)789 assert path_exists(newpath)
779790
780 unsubscribed = []791 unsubscribed = []
@@ -816,7 +827,7 @@
816827
817 uid = self.udf.volume_id828 uid = self.udf.volume_id
818 fnamedir = self.udf.path829 fnamedir = self.udf.path
819 os.rmdir(fnamedir)830 remove_dir(fnamedir)
820831
821 def check():832 def check():
822 """Check."""833 """Check."""
@@ -844,7 +855,7 @@
844 self.listener.events = []855 self.listener.events = []
845856
846 fnamedir = self.udf.path857 fnamedir = self.udf.path
847 os.rmdir(fnamedir)858 remove_dir(fnamedir)
848859
849 def check():860 def check():
850 """Check."""861 """Check."""
@@ -878,7 +889,7 @@
878 "Removed watches don't match the expected")889 "Removed watches don't match the expected")
879 self._deferred.callback(True)890 self._deferred.callback(True)
880891
881 os.rmdir(self.udf.path)892 remove_dir(self.udf.path)
882 reactor.callLater(.1, check)893 reactor.callLater(.1, check)
883 return self._deferred894 return self._deferred
884895
@@ -906,7 +917,7 @@
906 "Removed watches don't match the expected")917 "Removed watches don't match the expected")
907 self._deferred.callback(True)918 self._deferred.callback(True)
908919
909 os.rename(self.udf.path, self.udf.path + ".old")920 rename(self.udf.path, self.udf.path + ".old")
910 reactor.callLater(.1, check)921 reactor.callLater(.1, check)
911 return self._deferred922 return self._deferred
912923
@@ -936,8 +947,8 @@
936947
937 path = self.udf.ancestors[-2] # an ancestor common to both UDFs948 path = self.udf.ancestors[-2] # an ancestor common to both UDFs
938949
939 os.rename(self.udf.path, self.udf.path + ".old")950 rename(self.udf.path, self.udf.path + ".old")
940 os.rename(path, path + ".old")951 rename(path, path + ".old")
941 reactor.callLater(.1, check)952 reactor.callLater(.1, check)
942 return self._deferred953 return self._deferred
943954
@@ -957,7 +968,7 @@
957 def test_file_open(self):968 def test_file_open(self):
958 """Test invalid_filename after open a file."""969 """Test invalid_filename after open a file."""
959 open_file(self.invalid_path, "w").close()970 open_file(self.invalid_path, "w").close()
960 self.addCleanup(os.remove, self.invalid_path)971 self.addCleanup(remove_file, self.invalid_path)
961972
962 yield self.eq.add_watch(self.root_dir)973 yield self.eq.add_watch(self.root_dir)
963 should_events = [974 should_events = [
@@ -976,7 +987,7 @@
976 def test_file_close_nowrite(self):987 def test_file_close_nowrite(self):
977 """Test invalid_filename after a close no write."""988 """Test invalid_filename after a close no write."""
978 open_file(self.invalid_path, "w").close()989 open_file(self.invalid_path, "w").close()
979 self.addCleanup(os.remove, self.invalid_path)990 self.addCleanup(remove_file, self.invalid_path)
980 fh = open_file(self.invalid_path)991 fh = open_file(self.invalid_path)
981992
982 yield self.eq.add_watch(self.root_dir)993 yield self.eq.add_watch(self.root_dir)
@@ -1006,7 +1017,7 @@
10061017
1007 # generate the event1018 # generate the event
1008 open_file(self.invalid_path, "w").close()1019 open_file(self.invalid_path, "w").close()
1009 self.addCleanup(os.remove, self.invalid_path)1020 self.addCleanup(remove_file, self.invalid_path)
1010 yield self._deferred1021 yield self._deferred
10111022
1012 @defer.inlineCallbacks1023 @defer.inlineCallbacks
@@ -1021,7 +1032,7 @@
10211032
1022 # generate the event1033 # generate the event
1023 os.mkdir(self.invalid_path)1034 os.mkdir(self.invalid_path)
1024 self.addCleanup(os.rmdir, self.invalid_path)1035 self.addCleanup(remove_dir, self.invalid_path)
1025 yield self._deferred1036 yield self._deferred
10261037
1027 @defer.inlineCallbacks1038 @defer.inlineCallbacks
@@ -1037,7 +1048,7 @@
1037 self.eq.subscribe(DynamicHitMe(should_events, self))1048 self.eq.subscribe(DynamicHitMe(should_events, self))
10381049
1039 # generate the event1050 # generate the event
1040 os.remove(self.invalid_path)1051 remove_file(self.invalid_path)
1041 yield self._deferred1052 yield self._deferred
10421053
1043 @defer.inlineCallbacks1054 @defer.inlineCallbacks
@@ -1053,7 +1064,7 @@
1053 self.eq.subscribe(DynamicHitMe(should_events, self))1064 self.eq.subscribe(DynamicHitMe(should_events, self))
10541065
1055 # generate the event1066 # generate the event
1056 os.rmdir(self.invalid_path)1067 remove_dir(self.invalid_path)
1057 yield self._deferred1068 yield self._deferred
10581069
1059 @defer.inlineCallbacks1070 @defer.inlineCallbacks
@@ -1072,8 +1083,8 @@
1072 self.eq.subscribe(DynamicHitMe(should_events, self))1083 self.eq.subscribe(DynamicHitMe(should_events, self))
10731084
1074 # generate the event1085 # generate the event
1075 os.rename(self.invalid_path, destfile)1086 rename(self.invalid_path, destfile)
1076 self.addCleanup(os.remove, destfile)1087 self.addCleanup(remove_file, destfile)
1077 yield self._deferred1088 yield self._deferred
10781089
1079 @defer.inlineCallbacks1090 @defer.inlineCallbacks
@@ -1093,8 +1104,8 @@
1093 self.eq.subscribe(DynamicHitMe(should_events, self))1104 self.eq.subscribe(DynamicHitMe(should_events, self))
10941105
1095 # generate the event1106 # generate the event
1096 os.rename(fromfile, destfile)1107 rename(fromfile, destfile)
1097 self.addCleanup(os.remove, destfile)1108 self.addCleanup(remove_file, destfile)
1098 yield self._deferred1109 yield self._deferred
10991110
11001111
@@ -1113,7 +1124,7 @@
1113 if path != testfile:1124 if path != testfile:
1114 self.finished_error("received a wrong path")1125 self.finished_error("received a wrong path")
1115 else:1126 else:
1116 os.remove(testfile)1127 remove_file(testfile)
1117 self.finished_ok()1128 self.finished_ok()
11181129
1119 yield self.eq.add_watch(self.root_dir)1130 yield self.eq.add_watch(self.root_dir)
@@ -1137,7 +1148,7 @@
1137 if path != testfile:1148 if path != testfile:
1138 self.finished_error("received a wrong path")1149 self.finished_error("received a wrong path")
1139 else:1150 else:
1140 os.remove(testfile)1151 remove_file(testfile)
1141 self.finished_ok()1152 self.finished_ok()
11421153
1143 yield self.eq.add_watch(self.root_dir)1154 yield self.eq.add_watch(self.root_dir)
@@ -1169,7 +1180,7 @@
1169 self.finished_error("received a wrong path")1180 self.finished_error("received a wrong path")
1170 else:1181 else:
1171 if innerself.hist == ["create"]:1182 if innerself.hist == ["create"]:
1172 os.remove(testfile)1183 remove_file(testfile)
1173 self.finished_ok()1184 self.finished_ok()
1174 else:1185 else:
1175 msg = "Finished in bad condition: %s" % innerself.hist1186 msg = "Finished in bad condition: %s" % innerself.hist
@@ -1194,7 +1205,7 @@
1194 if path != testdir:1205 if path != testdir:
1195 self.finished_error("received a wrong path")1206 self.finished_error("received a wrong path")
1196 else:1207 else:
1197 os.rmdir(testdir)1208 remove_dir(testdir)
1198 self.finished_ok()1209 self.finished_ok()
11991210
1200 yield self.eq.add_watch(self.root_dir)1211 yield self.eq.add_watch(self.root_dir)
@@ -1228,7 +1239,7 @@
1228 self.eq.subscribe(HitMe())1239 self.eq.subscribe(HitMe())
12291240
1230 # generate the event1241 # generate the event
1231 os.remove(testfile)1242 remove_file(testfile)
1232 yield self._deferred1243 yield self._deferred
12331244
1234 @defer.inlineCallbacks1245 @defer.inlineCallbacks
@@ -1258,7 +1269,7 @@
1258 self.eq.subscribe(HitMe())1269 self.eq.subscribe(HitMe())
12591270
1260 # generate the event1271 # generate the event
1261 os.rmdir(testdir)1272 remove_dir(testdir)
1262 yield self._deferred1273 yield self._deferred
12631274
1264 @defer.inlineCallbacks1275 @defer.inlineCallbacks
@@ -1298,15 +1309,15 @@
1298 if path != fromfile:1309 if path != fromfile:
1299 self.finished_error("received a wrong path")1310 self.finished_error("received a wrong path")
1300 else:1311 else:
1301 os.remove(tofile)1312 remove_file(tofile)
1302 os.rmdir(helpdir)1313 remove_dir(helpdir)
1303 self.finished_ok()1314 self.finished_ok()
13041315
1305 yield self.eq.add_watch(self.root_dir)1316 yield self.eq.add_watch(self.root_dir)
1306 self.eq.subscribe(HitMe())1317 self.eq.subscribe(HitMe())
13071318
1308 # generate the event1319 # generate the event
1309 os.rename(fromfile, tofile)1320 rename(fromfile, tofile)
1310 yield self._deferred1321 yield self._deferred
13111322
1312 @defer.inlineCallbacks1323 @defer.inlineCallbacks
@@ -1325,15 +1336,15 @@
1325 if path != fromdir:1336 if path != fromdir:
1326 self.finished_error("received a wrong path")1337 self.finished_error("received a wrong path")
1327 else:1338 else:
1328 os.rmdir(todir)1339 remove_dir(todir)
1329 os.rmdir(helpdir)1340 remove_dir(helpdir)
1330 self.finished_ok()1341 self.finished_ok()
13311342
1332 yield self.eq.add_watch(self.root_dir)1343 yield self.eq.add_watch(self.root_dir)
1333 self.eq.subscribe(HitMe())1344 self.eq.subscribe(HitMe())
13341345
1335 # generate the event1346 # generate the event
1336 os.rename(fromdir, todir)1347 rename(fromdir, todir)
1337 yield self._deferred1348 yield self._deferred
13381349
1339 @defer.inlineCallbacks1350 @defer.inlineCallbacks
@@ -1352,15 +1363,15 @@
1352 if path != tofile:1363 if path != tofile:
1353 self.finished_error("received a wrong path")1364 self.finished_error("received a wrong path")
1354 else:1365 else:
1355 os.remove(tofile)1366 remove_file(tofile)
1356 os.rmdir(helpdir)1367 remove_dir(helpdir)
1357 self.finished_ok()1368 self.finished_ok()
13581369
1359 yield self.eq.add_watch(self.root_dir)1370 yield self.eq.add_watch(self.root_dir)
1360 self.eq.subscribe(HitMe())1371 self.eq.subscribe(HitMe())
13611372
1362 # generate the event1373 # generate the event
1363 os.rename(fromfile, tofile)1374 rename(fromfile, tofile)
1364 yield self._deferred1375 yield self._deferred
13651376
1366 @defer.inlineCallbacks1377 @defer.inlineCallbacks
@@ -1379,15 +1390,15 @@
1379 if path != todir:1390 if path != todir:
1380 self.finished_error("received a wrong path")1391 self.finished_error("received a wrong path")
1381 else:1392 else:
1382 os.rmdir(todir)1393 remove_dir(todir)
1383 os.rmdir(helpdir)1394 remove_dir(helpdir)
1384 self.finished_ok()1395 self.finished_ok()
13851396
1386 yield self.eq.add_watch(self.root_dir)1397 yield self.eq.add_watch(self.root_dir)
1387 self.eq.subscribe(HitMe())1398 self.eq.subscribe(HitMe())
13881399
1389 # generate the event1400 # generate the event
1390 os.rename(fromdir, todir)1401 rename(fromdir, todir)
1391 yield self._deferred1402 yield self._deferred
13921403
1393 @defer.inlineCallbacks1404 @defer.inlineCallbacks
@@ -1407,7 +1418,7 @@
1407 self.eq.subscribe(DynamicHitMe(should_events, self))1418 self.eq.subscribe(DynamicHitMe(should_events, self))
14081419
1409 # generate the event1420 # generate the event
1410 os.rename(fromdir, todir)1421 rename(fromdir, todir)
1411 yield self._deferred1422 yield self._deferred
14121423
1413 @defer.inlineCallbacks1424 @defer.inlineCallbacks
@@ -1427,7 +1438,7 @@
1427 self.eq.subscribe(DynamicHitMe(should_events, self))1438 self.eq.subscribe(DynamicHitMe(should_events, self))
14281439
1429 # generate the event1440 # generate the event
1430 os.rename(fromdir, todir)1441 rename(fromdir, todir)
1431 yield self._deferred1442 yield self._deferred
14321443
1433 @defer.inlineCallbacks1444 @defer.inlineCallbacks
@@ -1449,7 +1460,7 @@
1449 self.eq.subscribe(DynamicHitMe(should_events, self))1460 self.eq.subscribe(DynamicHitMe(should_events, self))
14501461
1451 # generate the event1462 # generate the event
1452 os.rename(fromfile, tofile)1463 rename(fromfile, tofile)
1453 yield self._deferred1464 yield self._deferred
14541465
1455 @defer.inlineCallbacks1466 @defer.inlineCallbacks
@@ -1469,7 +1480,7 @@
1469 self.eq.subscribe(DynamicHitMe(should_events, self))1480 self.eq.subscribe(DynamicHitMe(should_events, self))
14701481
1471 # generate the event1482 # generate the event
1472 os.rename(fromfile, tofile)1483 rename(fromfile, tofile)
1473 yield self._deferred1484 yield self._deferred
14741485
1475 @defer.inlineCallbacks1486 @defer.inlineCallbacks
@@ -1501,13 +1512,13 @@
15011512
1502 # generate the events1513 # generate the events
1503 open_file(mypath("foo"), "w").close()1514 open_file(mypath("foo"), "w").close()
1504 os.rename(mypath("foo"), mypath("dir", "foo"))1515 rename(mypath("foo"), mypath("dir", "foo"))
1505 open_file(mypath("bar"), "w").close()1516 open_file(mypath("bar"), "w").close()
1506 os.rename(mypath("dir", "foo"), mypath("foo"))1517 rename(mypath("dir", "foo"), mypath("foo"))
1507 os.rename(mypath("bar"), mypath("dir", "bar"))1518 rename(mypath("bar"), mypath("dir", "bar"))
1508 os.remove(mypath("foo"))1519 remove_file(mypath("foo"))
1509 os.rename(mypath("dir", "bar"), mypath("bar"))1520 rename(mypath("dir", "bar"), mypath("bar"))
1510 os.remove(mypath("bar"))1521 remove_file(mypath("bar"))
1511 yield self._deferred1522 yield self._deferred
15121523
1513 @defer.inlineCallbacks1524 @defer.inlineCallbacks
@@ -1530,14 +1541,14 @@
1530 elif path_to != tofile:1541 elif path_to != tofile:
1531 self.finished_error("received a wrong path in to")1542 self.finished_error("received a wrong path in to")
1532 else:1543 else:
1533 os.remove(tofile)1544 remove_file(tofile)
1534 self.finished_ok()1545 self.finished_ok()
15351546
1536 yield self.eq.add_watch(self.root_dir)1547 yield self.eq.add_watch(self.root_dir)
1537 self.eq.subscribe(HitMe())1548 self.eq.subscribe(HitMe())
15381549
1539 # generate the event1550 # generate the event
1540 os.rename(fromfile, tofile)1551 rename(fromfile, tofile)
1541 yield self._deferred1552 yield self._deferred
15421553
1543 @defer.inlineCallbacks1554 @defer.inlineCallbacks
@@ -1560,14 +1571,14 @@
1560 elif path_to != todir:1571 elif path_to != todir:
1561 self.finished_error("received a wrong path in to")1572 self.finished_error("received a wrong path in to")
1562 else:1573 else:
1563 os.rmdir(todir)1574 remove_dir(todir)
1564 self.finished_ok()1575 self.finished_ok()
15651576
1566 yield self.eq.add_watch(self.root_dir)1577 yield self.eq.add_watch(self.root_dir)
1567 self.eq.subscribe(HitMe())1578 self.eq.subscribe(HitMe())
15681579
1569 # generate the event1580 # generate the event
1570 os.rename(fromdir, todir)1581 rename(fromdir, todir)
1571 yield self._deferred1582 yield self._deferred
15721583
1573 @defer.inlineCallbacks1584 @defer.inlineCallbacks
@@ -1603,11 +1614,11 @@
1603 # generate the events1614 # generate the events
1604 open_file(mypath("foo"), "w").close()1615 open_file(mypath("foo"), "w").close()
1605 open_file(mypath("bar"), "w").close()1616 open_file(mypath("bar"), "w").close()
1606 os.rename(mypath("foo"), mypath("dir", "foo"))1617 rename(mypath("foo"), mypath("dir", "foo"))
1607 os.rename(mypath("dir", "foo"), mypath("foo"))1618 rename(mypath("dir", "foo"), mypath("foo"))
1608 os.rename(mypath("bar"), mypath("baz"))1619 rename(mypath("bar"), mypath("baz"))
1609 os.remove(mypath("foo"))1620 remove_file(mypath("foo"))
1610 os.remove(mypath("baz"))1621 remove_file(mypath("baz"))
1611 yield self._deferred1622 yield self._deferred
16121623
1613 @defer.inlineCallbacks1624 @defer.inlineCallbacks
@@ -1646,7 +1657,7 @@
1646 self.eq.subscribe(HitMe())1657 self.eq.subscribe(HitMe())
16471658
1648 # generate the event1659 # generate the event
1649 os.rename(testdir, os.path.join(trash, os.path.basename(testdir)))1660 rename(testdir, os.path.join(trash, os.path.basename(testdir)))
1650 yield self._deferred1661 yield self._deferred
16511662
1652 @defer.inlineCallbacks1663 @defer.inlineCallbacks
@@ -1665,8 +1676,8 @@
1665 if path != newfilepath:1676 if path != newfilepath:
1666 self.finished_error("received a wrong path")1677 self.finished_error("received a wrong path")
1667 else:1678 else:
1668 os.remove(newfilepath)1679 remove_file(newfilepath)
1669 os.rmdir(newdirname)1680 remove_dir(newdirname)
1670 self.finished_ok()1681 self.finished_ok()
16711682
1672 yield self.eq.add_watch(self.root_dir)1683 yield self.eq.add_watch(self.root_dir)
@@ -1674,7 +1685,7 @@
1674 self.eq.subscribe(HitMe())1685 self.eq.subscribe(HitMe())
16751686
1676 # rename the dir1687 # rename the dir
1677 os.rename(testdir, newdirname)1688 rename(testdir, newdirname)
16781689
1679 # generate the event1690 # generate the event
1680 newfilepath = os.path.join(newdirname, "afile")1691 newfilepath = os.path.join(newdirname, "afile")
@@ -1699,7 +1710,7 @@
1699 yield self.eq.add_watch(root_dir)1710 yield self.eq.add_watch(root_dir)
17001711
1701 # generate the event1712 # generate the event
1702 os.rename(fromfile, tofile)1713 rename(fromfile, tofile)
1703 yield self._deferred1714 yield self._deferred
17041715
1705 @defer.inlineCallbacks1716 @defer.inlineCallbacks
@@ -1721,7 +1732,7 @@
1721 yield self.eq.add_watch(root_dir)1732 yield self.eq.add_watch(root_dir)
17221733
1723 # generate the event1734 # generate the event
1724 os.rename(fromdir, todir)1735 rename(fromdir, todir)
1725 yield self._deferred1736 yield self._deferred
17261737
1727 @defer.inlineCallbacks1738 @defer.inlineCallbacks
@@ -1750,8 +1761,8 @@
1750 yield self.eq.add_watch(dir1)1761 yield self.eq.add_watch(dir1)
17511762
1752 # generate the event1763 # generate the event
1753 os.rename(dir1, dir2)1764 rename(dir1, dir2)
1754 os.remove(tofile)1765 remove_file(tofile)
1755 yield self._deferred1766 yield self._deferred
17561767
1757 @defer.inlineCallbacks1768 @defer.inlineCallbacks
@@ -1771,7 +1782,7 @@
1771 yield self.eq.add_watch(self.root_dir)1782 yield self.eq.add_watch(self.root_dir)
17721783
1773 # generate the event1784 # generate the event
1774 os.rename(testfile + ".u1conflict", destfile)1785 rename(testfile + ".u1conflict", destfile)
1775 yield self._deferred1786 yield self._deferred
17761787
1777 @defer.inlineCallbacks1788 @defer.inlineCallbacks
@@ -1790,7 +1801,7 @@
1790 yield self.eq.add_watch(self.root_dir)1801 yield self.eq.add_watch(self.root_dir)
17911802
1792 # generate the event1803 # generate the event
1793 os.rename(testfile + ".u1conflict", testfile)1804 rename(testfile + ".u1conflict", testfile)
1794 yield self._deferred1805 yield self._deferred
17951806
1796 @defer.inlineCallbacks1807 @defer.inlineCallbacks
@@ -1808,7 +1819,7 @@
1808 yield self.eq.add_watch(self.root_dir)1819 yield self.eq.add_watch(self.root_dir)
18091820
1810 # generate the event1821 # generate the event
1811 os.rename(testdir + ".u1conflict", testdir)1822 rename(testdir + ".u1conflict", testdir)
1812 yield self._deferred1823 yield self._deferred
18131824
1814 @defer.inlineCallbacks1825 @defer.inlineCallbacks
@@ -1827,7 +1838,7 @@
1827 yield self.eq.add_watch(self.root_dir)1838 yield self.eq.add_watch(self.root_dir)
18281839
1829 # generate the event1840 # generate the event
1830 os.rename(testdir + ".u1conflict", destdir)1841 rename(testdir + ".u1conflict", destdir)
1831 yield self._deferred1842 yield self._deferred
18321843
1833 @defer.inlineCallbacks1844 @defer.inlineCallbacks
@@ -1856,8 +1867,8 @@
1856 # generate the event1867 # generate the event
1857 open_file(testfile, "w").close()1868 open_file(testfile, "w").close()
1858 # and change the permissions so it's ignored1869 # and change the permissions so it's ignored
1859 os.chmod(testfile, 0000)1870 set_no_rights(testfile)
1860 self.addCleanup(os.chmod, testfile, 0644)1871 self.addCleanup(set_file_readwrite, testfile)
18611872
1862 def check(record):1873 def check(record):
1863 self.assertIn(testfile, record.args)1874 self.assertIn(testfile, record.args)
@@ -1891,8 +1902,8 @@
1891 # generate the event1902 # generate the event
1892 os.makedirs(testdir)1903 os.makedirs(testdir)
1893 # and change the permissions so it's ignored1904 # and change the permissions so it's ignored
1894 os.chmod(testdir, 0000)1905 set_no_rights(testdir)
1895 self.addCleanup(os.chmod, testdir, 0755)1906 self.addCleanup(set_dir_readwrite, testdir)
18961907
1897 def check(record):1908 def check(record):
1898 self.assertIn(testdir, record.args)1909 self.assertIn(testdir, record.args)
@@ -1935,7 +1946,7 @@
1935 yield self.eq.add_watch(base2)1946 yield self.eq.add_watch(base2)
19361947
1937 # generate the event1948 # generate the event
1938 os.rename(moving1, moving2)1949 rename(moving1, moving2)
1939 yield self._deferred1950 yield self._deferred
19401951
1941 @defer.inlineCallbacks1952 @defer.inlineCallbacks
@@ -1966,5 +1977,5 @@
1966 yield self.eq.add_watch(base2)1977 yield self.eq.add_watch(base2)
19671978
1968 # generate the event1979 # generate the event
1969 os.rename(moving1, moving2)1980 rename(moving1, moving2)
1970 yield self._deferred1981 yield self._deferred
19711982
=== modified file 'tests/syncdaemon/test_fsm.py'
--- tests/syncdaemon/test_fsm.py 2011-08-04 16:30:54 +0000
+++ tests/syncdaemon/test_fsm.py 2011-08-09 16:37:30 +0000
@@ -37,7 +37,16 @@
37)37)
3838
39from ubuntuone.devtools.handlers import MementoHandler39from ubuntuone.devtools.handlers import MementoHandler
40from ubuntuone.platform import make_dir, make_link, open_file, path_exists40from ubuntuone.platform import (
41 make_dir,
42 make_link,
43 open_file,
44 path_exists,
45 remove_dir,
46 remove_file,
47 set_dir_readonly,
48 set_dir_readwrite,
49)
41from ubuntuone.syncdaemon.filesystem_manager import (50from ubuntuone.syncdaemon.filesystem_manager import (
42 DirectoryNotRemovable,51 DirectoryNotRemovable,
43 EnableShareWrite,52 EnableShareWrite,
@@ -84,9 +93,11 @@
84 self.tritcask_path = self.mktemp("tritcask")93 self.tritcask_path = self.mktemp("tritcask")
8594
86 self.db = Tritcask(self.tritcask_path)95 self.db = Tritcask(self.tritcask_path)
96 self.addCleanup(self.db.shutdown)
87 self.fsm = FileSystemManager(self.fsmdir, self.partials_dir,97 self.fsm = FileSystemManager(self.fsmdir, self.partials_dir,
88 FakeVolumeManager(self.root_dir), self.db)98 FakeVolumeManager(self.root_dir), self.db)
89 self.eq = EventQueue(self.fsm)99 self.eq = EventQueue(self.fsm)
100 self.addCleanup(self.eq.shutdown)
90 self.fsm.register_eq(self.eq)101 self.fsm.register_eq(self.eq)
91 self.share = yield self.create_share('share', 'share_name')102 self.share = yield self.create_share('share', 'share_name')
92 self.share_path = self.share.path103 self.share_path = self.share.path
@@ -96,15 +107,7 @@
96 self.handler = MementoHandler()107 self.handler = MementoHandler()
97 self.handler.setLevel(0)108 self.handler.setLevel(0)
98 logger.root_logger.addHandler(self.handler)109 logger.root_logger.addHandler(self.handler)
99110 self.addCleanup(logger.root_logger.removeHandler, self.handler)
100 @defer.inlineCallbacks
101 def tearDown(self):
102 """Clean up the tests."""
103 self.eq.shutdown()
104 self.db.shutdown()
105 # remove the handler
106 logger.root_logger.removeHandler(self.handler)
107 yield super(FSMTestCase, self).tearDown()
108111
109 @defer.inlineCallbacks112 @defer.inlineCallbacks
110 def create_share(self, share_id, share_name, fsm=None, shares_dir=None,113 def create_share(self, share_id, share_name, fsm=None, shares_dir=None,
@@ -144,7 +147,7 @@
144 db = Tritcask(fsmdir)147 db = Tritcask(fsmdir)
145 FileSystemManager(fsmdir, partials_dir,148 FileSystemManager(fsmdir, partials_dir,
146 FakeVolumeManager(fsmdir), db)149 FakeVolumeManager(fsmdir), db)
147 self.assertTrue(os.path.exists(fsmdir))150 self.assertTrue(path_exists(fsmdir))
148 db.shutdown()151 db.shutdown()
149152
150 @defer.inlineCallbacks153 @defer.inlineCallbacks
@@ -319,7 +322,7 @@
319322
320 # delete the version that should have left the previous fsm323 # delete the version that should have left the previous fsm
321 version_file = os.path.join(self.fsmdir, "metadata_version")324 version_file = os.path.join(self.fsmdir, "metadata_version")
322 os.remove(version_file)325 remove_file(version_file)
323326
324 # create a old-style fs with the data:327 # create a old-style fs with the data:
325 old_fs = FileShelf(self.fsm.old_fs._path)328 old_fs = FileShelf(self.fsm.old_fs._path)
@@ -682,7 +685,7 @@
682685
683 # delete the version that should have left the previous fsm686 # delete the version that should have left the previous fsm
684 version_file = os.path.join(self.fsmdir, "metadata_version")687 version_file = os.path.join(self.fsmdir, "metadata_version")
685 os.remove(version_file)688 remove_file(version_file)
686689
687 # start up again, and check690 # start up again, and check
688 db = Tritcask(self.tritcask_path+'.new')691 db = Tritcask(self.tritcask_path+'.new')
@@ -838,7 +841,7 @@
838841
839 # delete the version that should have left the previous fsm842 # delete the version that should have left the previous fsm
840 version_file = os.path.join(self.fsmdir, "metadata_version")843 version_file = os.path.join(self.fsmdir, "metadata_version")
841 os.remove(version_file)844 remove_file(version_file)
842845
843 # start up again, and check846 # start up again, and check
844 db = Tritcask(self.tritcask_path+'.new')847 db = Tritcask(self.tritcask_path+'.new')
@@ -1063,6 +1066,7 @@
1063 mdid, mdid_1)1066 mdid, mdid_1)
1064 db.shutdown()1067 db.shutdown()
10651068
1069
1066class GetSetTests(FSMTestCase):1070class GetSetTests(FSMTestCase):
1067 """Test the get/set interface."""1071 """Test the get/set interface."""
10681072
@@ -1491,14 +1495,18 @@
14911495
1492 def test_no_tree(self):1496 def test_no_tree(self):
1493 """Test just receiving the dir and not the tree."""1497 """Test just receiving the dir and not the tree."""
1494 expected = ['a/b', 'a/b1', 'a/b2', 'a/c', 'a/x.txt']1498 expected = [os.path.join('a', 'b'),
1499 os.path.join('a', 'b1'),
1500 os.path.join( 'a', 'b2'),
1501 os.path.join( 'a', 'c'),
1502 os.path.join( 'a', 'x.txt')]
1495 actual = sorted([d.path for d in self.fsm.get_mdobjs_in_dir(1503 actual = sorted([d.path for d in self.fsm.get_mdobjs_in_dir(
1496 os.path.join(self.share.path, 'a'))])1504 os.path.join(self.share.path, 'a'))])
1497 self.assertEqual(expected, actual)1505 self.assertEqual(expected, actual)
14981506
1499 def test_similar_paths(self):1507 def test_similar_paths(self):
1500 """Test having similar paths (a/b, a/b1, a/b2)."""1508 """Test having similar paths (a/b, a/b1, a/b2)."""
1501 expected = ['a/b/y.txt']1509 expected = [os.path.join('a', 'b', 'y.txt')]
1502 actual = sorted([d.path for d in self.fsm.get_mdobjs_in_dir(1510 actual = sorted([d.path for d in self.fsm.get_mdobjs_in_dir(
1503 os.path.join(self.share.path, 'a', 'b'))])1511 os.path.join(self.share.path, 'a', 'b'))])
1504 self.assertEqual(expected, actual)1512 self.assertEqual(expected, actual)
@@ -1639,7 +1647,7 @@
1639 # create partial ok1647 # create partial ok
1640 self.fsm.create_partial("uuid", "share")1648 self.fsm.create_partial("uuid", "share")
1641 self.assertTrue(self.fsm.get_by_mdid(mdid).info.is_partial)1649 self.assertTrue(self.fsm.get_by_mdid(mdid).info.is_partial)
1642 self.assertTrue(os.path.exists(partial_path))1650 self.assertTrue(path_exists(partial_path))
1643 mdobj = self.fsm.get_by_mdid(mdid)1651 mdobj = self.fsm.get_by_mdid(mdid)
1644 when = mdobj.info.last_partial_created1652 when = mdobj.info.last_partial_created
1645 now = time.time()1653 now = time.time()
@@ -1668,7 +1676,7 @@
16681676
1669 # commit partial, and check that the file is moved, and metadata is ok1677 # commit partial, and check that the file is moved, and metadata is ok
1670 self.fsm.commit_partial("uuid", "share", local_hash=9876)1678 self.fsm.commit_partial("uuid", "share", local_hash=9876)
1671 self.assertFalse(os.path.exists(partial_path))1679 self.assertFalse(path_exists(partial_path))
1672 with open(testfile) as fh:1680 with open(testfile) as fh:
1673 in_file = fh.read()1681 in_file = fh.read()
1674 self.assertEqual(in_file, "test info!")1682 self.assertEqual(in_file, "test info!")
@@ -1706,7 +1714,7 @@
17061714
1707 # remove partial, and check that the file is gone, and metadata is ok1715 # remove partial, and check that the file is gone, and metadata is ok
1708 self.fsm.remove_partial("uuid", "share")1716 self.fsm.remove_partial("uuid", "share")
1709 self.assertFalse(os.path.exists(partial_path))1717 self.assertFalse(path_exists(partial_path))
1710 with open(testfile) as fh:1718 with open(testfile) as fh:
1711 in_file = fh.read()1719 in_file = fh.read()
1712 self.assertEqual(in_file, "previous stuff!")1720 self.assertEqual(in_file, "previous stuff!")
@@ -1735,7 +1743,7 @@
1735 self.assertTrue(self.fsm.get_by_mdid(mdid).info.is_partial)1743 self.assertTrue(self.fsm.get_by_mdid(mdid).info.is_partial)
1736 partial_path = os.path.join(self.fsm.partials_dir,1744 partial_path = os.path.join(self.fsm.partials_dir,
1737 mdid + ".u1partial." + os.path.basename(testdir))1745 mdid + ".u1partial." + os.path.basename(testdir))
1738 self.assertTrue(os.path.exists(partial_path))1746 self.assertTrue(path_exists(partial_path))
1739 mdobj = self.fsm.get_by_mdid(mdid)1747 mdobj = self.fsm.get_by_mdid(mdid)
1740 when = mdobj.info.last_partial_created1748 when = mdobj.info.last_partial_created
1741 now = time.time()1749 now = time.time()
@@ -1756,10 +1764,10 @@
1756 # create partial ok1764 # create partial ok
1757 self.fsm.create_partial("uuid", "share")1765 self.fsm.create_partial("uuid", "share")
1758 self.assertTrue(self.fsm.get_by_mdid(mdid).info.is_partial)1766 self.assertTrue(self.fsm.get_by_mdid(mdid).info.is_partial)
1759 self.assertTrue(os.path.exists(testdir))1767 self.assertTrue(path_exists(testdir))
1760 partial_path = os.path.join(self.fsm.partials_dir,1768 partial_path = os.path.join(self.fsm.partials_dir,
1761 mdid + ".u1partial." + os.path.basename(testdir))1769 mdid + ".u1partial." + os.path.basename(testdir))
1762 self.assertTrue(os.path.exists(partial_path))1770 self.assertTrue(path_exists(partial_path))
1763 mdobj = self.fsm.get_by_mdid(mdid)1771 mdobj = self.fsm.get_by_mdid(mdid)
1764 when = mdobj.info.last_partial_created1772 when = mdobj.info.last_partial_created
1765 now = time.time()1773 now = time.time()
@@ -1799,7 +1807,7 @@
1799 self.fsm.remove_partial("uuid", "share")1807 self.fsm.remove_partial("uuid", "share")
1800 partial_path = os.path.join(self.fsm.partials_dir,1808 partial_path = os.path.join(self.fsm.partials_dir,
1801 mdid + ".u1partial." + os.path.basename(testdir))1809 mdid + ".u1partial." + os.path.basename(testdir))
1802 self.assertFalse(os.path.exists(partial_path))1810 self.assertFalse(path_exists(partial_path))
1803 mdobj = self.fsm.get_by_mdid(mdid)1811 mdobj = self.fsm.get_by_mdid(mdid)
1804 self.assertFalse(mdobj.info.is_partial)1812 self.assertFalse(mdobj.info.is_partial)
1805 when = mdobj.info.last_partial_removed1813 when = mdobj.info.last_partial_removed
@@ -1842,7 +1850,7 @@
1842 self.fsm.set_node_id(testfile, "uuid")1850 self.fsm.set_node_id(testfile, "uuid")
18431851
1844 # ugly problem not handled1852 # ugly problem not handled
1845 os.rmdir(self.partials_dir)1853 remove_dir(self.partials_dir)
1846 try:1854 try:
1847 self.fsm.create_partial("uuid", "share")1855 self.fsm.create_partial("uuid", "share")
1848 except IOError, e:1856 except IOError, e:
@@ -1871,7 +1879,7 @@
1871 repeat -= 101879 repeat -= 10
1872 else:1880 else:
1873 fh.close()1881 fh.close()
1874 os.unlink(testfile)1882 remove_file(testfile)
1875 break1883 break
1876 mdid = self.fsm.create(testfile, "share")1884 mdid = self.fsm.create(testfile, "share")
1877 self.fsm.set_node_id(testfile, "uuid")1885 self.fsm.set_node_id(testfile, "uuid")
@@ -1978,7 +1986,7 @@
19781986
1979 # move first time1987 # move first time
1980 self.fsm.move_to_conflict(mdid)1988 self.fsm.move_to_conflict(mdid)
1981 self.assertFalse(os.path.exists(testfile))1989 self.assertFalse(path_exists(testfile))
1982 with open(testfile + self.fsm.CONFLICT_SUFFIX) as fh:1990 with open(testfile + self.fsm.CONFLICT_SUFFIX) as fh:
1983 in_file = fh.read()1991 in_file = fh.read()
1984 self.assertEqual(in_file, "test!")1992 self.assertEqual(in_file, "test!")
@@ -1991,7 +1999,7 @@
1991 with open(testfile, "w") as fh:1999 with open(testfile, "w") as fh:
1992 fh.write("test 1!")2000 fh.write("test 1!")
1993 self.fsm.move_to_conflict(mdid)2001 self.fsm.move_to_conflict(mdid)
1994 self.assertFalse(os.path.exists(testfile))2002 self.assertFalse(path_exists(testfile))
1995 with open(testfile + ".u1conflict.1") as fh:2003 with open(testfile + ".u1conflict.1") as fh:
1996 in_file = fh.read()2004 in_file = fh.read()
1997 self.assertEqual(in_file, "test 1!")2005 self.assertEqual(in_file, "test 1!")
@@ -2004,7 +2012,7 @@
2004 with open(testfile, "w") as fh:2012 with open(testfile, "w") as fh:
2005 fh.write("test 6!")2013 fh.write("test 6!")
2006 self.fsm.move_to_conflict(mdid)2014 self.fsm.move_to_conflict(mdid)
2007 self.assertFalse(os.path.exists(testfile))2015 self.assertFalse(path_exists(testfile))
2008 with open(testfile + ".u1conflict.6") as fh:2016 with open(testfile + ".u1conflict.6") as fh:
2009 in_file = fh.read()2017 in_file = fh.read()
2010 self.assertEqual(in_file, "test 6!")2018 self.assertEqual(in_file, "test 6!")
@@ -2079,7 +2087,7 @@
2079 # move the file2087 # move the file
2080 to_path = os.path.join(self.share_path, "path2")2088 to_path = os.path.join(self.share_path, "path2")
2081 self.fsm.move_file("share", testfile, to_path)2089 self.fsm.move_file("share", testfile, to_path)
2082 self.assertFalse(os.path.exists(testfile))2090 self.assertFalse(path_exists(testfile))
2083 with open(to_path) as fh:2091 with open(to_path) as fh:
2084 in_file = fh.read()2092 in_file = fh.read()
2085 self.assertEqual(in_file, "test!")2093 self.assertEqual(in_file, "test!")
@@ -2094,7 +2102,7 @@
2094 os.mkdir(os.path.join(self.share_path, "testdir"))2102 os.mkdir(os.path.join(self.share_path, "testdir"))
2095 to_path = os.path.join(self.share_path, "testdir", "path3")2103 to_path = os.path.join(self.share_path, "testdir", "path3")
2096 self.fsm.move_file("share", from_path, to_path)2104 self.fsm.move_file("share", from_path, to_path)
2097 self.assertFalse(os.path.exists(from_path))2105 self.assertFalse(path_exists(from_path))
2098 with open(to_path) as fh:2106 with open(to_path) as fh:
2099 in_file = fh.read()2107 in_file = fh.read()
2100 self.assertEqual(in_file, "test!")2108 self.assertEqual(in_file, "test!")
@@ -2128,7 +2136,7 @@
21282136
2129 # move the file2137 # move the file
2130 self.fsm.move_file("share", testfile1, testfile2)2138 self.fsm.move_file("share", testfile1, testfile2)
2131 self.assertFalse(os.path.exists(testfile1))2139 self.assertFalse(path_exists(testfile1))
2132 with open(testfile2) as fh:2140 with open(testfile2) as fh:
2133 in_file = fh.read()2141 in_file = fh.read()
2134 self.assertEqual(in_file, "test 1")2142 self.assertEqual(in_file, "test 1")
@@ -2152,8 +2160,8 @@
2152 os.mkdir(from_path)2160 os.mkdir(from_path)
2153 to_path = os.path.join(self.share_path, "path2")2161 to_path = os.path.join(self.share_path, "path2")
2154 self.fsm.move_file("share", from_path, to_path)2162 self.fsm.move_file("share", from_path, to_path)
2155 self.assertFalse(os.path.exists(from_path))2163 self.assertFalse(path_exists(from_path))
2156 self.assertTrue(os.path.exists(to_path))2164 self.assertTrue(path_exists(to_path))
2157 mdobj = self.fsm.get_by_mdid(mdid)2165 mdobj = self.fsm.get_by_mdid(mdid)
2158 self.assertEqual(mdobj.info.last_moved_from, from_path)2166 self.assertEqual(mdobj.info.last_moved_from, from_path)
2159 when = mdobj.info.last_moved_time2167 when = mdobj.info.last_moved_time
@@ -2165,8 +2173,8 @@
2165 os.mkdir(os.path.join(self.share_path, "testdir"))2173 os.mkdir(os.path.join(self.share_path, "testdir"))
2166 to_path = os.path.join(self.share_path, "testdir", "path3")2174 to_path = os.path.join(self.share_path, "testdir", "path3")
2167 self.fsm.move_file("share", from_path, to_path)2175 self.fsm.move_file("share", from_path, to_path)
2168 self.assertFalse(os.path.exists(from_path))2176 self.assertFalse(path_exists(from_path))
2169 self.assertTrue(os.path.exists(to_path))2177 self.assertTrue(path_exists(to_path))
2170 mdobj = self.fsm.get_by_mdid(mdid)2178 mdobj = self.fsm.get_by_mdid(mdid)
2171 self.assertEqual(mdobj.info.last_moved_from, from_path)2179 self.assertEqual(mdobj.info.last_moved_from, from_path)
2172 when = mdobj.info.last_moved_time2180 when = mdobj.info.last_moved_time
@@ -2196,8 +2204,8 @@
2196 # move the dir2204 # move the dir
2197 to_path = os.path.join(self.share_path, "path2")2205 to_path = os.path.join(self.share_path, "path2")
2198 self.fsm.move_file("share", from_path, to_path)2206 self.fsm.move_file("share", from_path, to_path)
2199 self.assertFalse(os.path.exists(from_path))2207 self.assertFalse(path_exists(from_path))
2200 self.assertTrue(os.path.exists(to_path))2208 self.assertTrue(path_exists(to_path))
2201 mdobj = self.fsm.get_by_mdid(mdid)2209 mdobj = self.fsm.get_by_mdid(mdid)
2202 self.assertEqual(mdobj.info.last_moved_from, from_path)2210 self.assertEqual(mdobj.info.last_moved_from, from_path)
2203 when = mdobj.info.last_moved_time2211 when = mdobj.info.last_moved_time
@@ -2206,14 +2214,14 @@
22062214
2207 # check that file inside is ok2215 # check that file inside is ok
2208 newfilepath = os.path.join(to_path, "file.txt")2216 newfilepath = os.path.join(to_path, "file.txt")
2209 self.assertFalse(os.path.exists(filepath))2217 self.assertFalse(path_exists(filepath))
2210 self.assertTrue(os.path.exists(newfilepath))2218 self.assertTrue(path_exists(newfilepath))
2211 mdobj = self.fsm.get_by_path(newfilepath)2219 mdobj = self.fsm.get_by_path(newfilepath)
2212 self.assertEqual(mdobj.mdid, fileid)2220 self.assertEqual(mdobj.mdid, fileid)
2213 self.assertEqual(mdobj.path, "path2/file.txt")2221 self.assertEqual(mdobj.path, os.path.join('path2', 'file.txt'))
22142222
2215 # check the outer file2223 # check the outer file
2216 self.assertTrue(os.path.exists(otherfile))2224 self.assertTrue(path_exists(otherfile))
2217 mdobj = self.fsm.get_by_path(otherfile)2225 mdobj = self.fsm.get_by_path(otherfile)
2218 self.assertEqual(mdobj.path, "pa")2226 self.assertEqual(mdobj.path, "pa")
22192227
@@ -2226,7 +2234,7 @@
22262234
2227 # delete the file2235 # delete the file
2228 self.fsm.delete_file(testfile)2236 self.fsm.delete_file(testfile)
2229 self.assertFalse(os.path.exists(testfile))2237 self.assertFalse(path_exists(testfile))
2230 self.assert_no_metadata(mdid, testfile, "share", "uuid")2238 self.assert_no_metadata(mdid, testfile, "share", "uuid")
22312239
2232 def test_delete_file_directly(self):2240 def test_delete_file_directly(self):
@@ -2267,12 +2275,12 @@
2267 self.assertEqual(self.fsm.get_by_mdid(mdid).path, "path")2275 self.assertEqual(self.fsm.get_by_mdid(mdid).path, "path")
2268 self.assertEqual(self.fsm.get_by_path(testdir).path, "path")2276 self.assertEqual(self.fsm.get_by_path(testdir).path, "path")
2269 self.assertEqual(self.fsm.get_by_node_id("share", "uuid").path, "path")2277 self.assertEqual(self.fsm.get_by_node_id("share", "uuid").path, "path")
2270 os.remove(os.path.join(testdir, "foo"))2278 remove_file(os.path.join(testdir, "foo"))
22712279
2272 # really delete the dir2280 # really delete the dir
2273 self.fsm.delete_file(testdir)2281 self.fsm.delete_file(testdir)
22742282
2275 self.assertFalse(os.path.exists(testdir))2283 self.assertFalse(path_exists(testdir))
2276 self.assert_no_metadata(mdid, testdir, "share", "uuid")2284 self.assert_no_metadata(mdid, testdir, "share", "uuid")
22772285
2278 def test_delete_dir_directly(self):2286 def test_delete_dir_directly(self):
@@ -2318,10 +2326,10 @@
23182326
2319 self.fsm.delete_file(local_dir)2327 self.fsm.delete_file(local_dir)
23202328
2321 self.assertFalse(os.path.exists(local_file))2329 self.assertFalse(path_exists(local_file))
2322 self.assert_no_metadata(mdid_file, local_file, "", "uuid_file")2330 self.assert_no_metadata(mdid_file, local_file, "", "uuid_file")
23232331
2324 self.assertFalse(os.path.exists(local_dir))2332 self.assertFalse(path_exists(local_dir))
2325 self.assert_no_metadata(mdid, local_dir, "", "uuid")2333 self.assert_no_metadata(mdid, local_dir, "", "uuid")
23262334
2327 def test_delete_nonempty_cleanable_dir_directly(self):2335 def test_delete_nonempty_cleanable_dir_directly(self):
@@ -2459,11 +2467,11 @@
24592467
2460 # move the dir to conflict, the file is still there, but with no MD2468 # move the dir to conflict, the file is still there, but with no MD
2461 self.fsm.move_to_conflict(mdid1)2469 self.fsm.move_to_conflict(mdid1)
2462 self.assertFalse(os.path.exists(tdir))2470 self.assertFalse(path_exists(tdir))
2463 self.assertTrue(os.path.exists(tdir + self.fsm.CONFLICT_SUFFIX))2471 self.assertTrue(path_exists(tdir + self.fsm.CONFLICT_SUFFIX))
2464 testfile = os.path.join(self.share_path,2472 testfile = os.path.join(self.share_path,
2465 tdir + self.fsm.CONFLICT_SUFFIX, "path")2473 tdir + self.fsm.CONFLICT_SUFFIX, "path")
2466 self.assertTrue(os.path.exists(testfile))2474 self.assertTrue(path_exists(testfile))
2467 self.assertTrue(self.fsm.get_by_mdid(mdid1))2475 self.assertTrue(self.fsm.get_by_mdid(mdid1))
2468 self.assert_no_metadata(mdid2, testfile, "share", "uuid2")2476 self.assert_no_metadata(mdid2, testfile, "share", "uuid2")
24692477
@@ -2487,16 +2495,16 @@
24872495
2488 # move the dir2 to conflict, see dir2 and file inside it went ok2496 # move the dir2 to conflict, see dir2 and file inside it went ok
2489 self.fsm.move_to_conflict(mdid2)2497 self.fsm.move_to_conflict(mdid2)
2490 self.assertFalse(os.path.exists(tdir2))2498 self.assertFalse(path_exists(tdir2))
2491 self.assertTrue(os.path.exists(tdir2 + self.fsm.CONFLICT_SUFFIX))2499 self.assertTrue(path_exists(tdir2 + self.fsm.CONFLICT_SUFFIX))
2492 testfile = os.path.join(self.share_path,2500 testfile = os.path.join(self.share_path,
2493 tdir2 + self.fsm.CONFLICT_SUFFIX, "path")2501 tdir2 + self.fsm.CONFLICT_SUFFIX, "path")
2494 self.assertTrue(os.path.exists(testfile))2502 self.assertTrue(path_exists(testfile))
2495 self.assertTrue(self.fsm.get_by_mdid(mdid2))2503 self.assertTrue(self.fsm.get_by_mdid(mdid2))
2496 self.assertRaises(KeyError, self.fsm.get_by_mdid, mdid3)2504 self.assertRaises(KeyError, self.fsm.get_by_mdid, mdid3)
24972505
2498 # and check that the one with similar path is untouched2506 # and check that the one with similar path is untouched
2499 self.assertTrue(os.path.exists(tdir1))2507 self.assertTrue(path_exists(tdir1))
2500 self.assertTrue(self.fsm.get_by_mdid(mdid1))2508 self.assertTrue(self.fsm.get_by_mdid(mdid1))
25012509
25022510
@@ -2815,7 +2823,7 @@
2815 mdid = self.fsm.create(local_dir, "", is_dir=True)2823 mdid = self.fsm.create(local_dir, "", is_dir=True)
2816 os.mkdir(local_dir)2824 os.mkdir(local_dir)
2817 self.fsm.make_dir(mdid)2825 self.fsm.make_dir(mdid)
2818 self.assertTrue(os.path.exists(local_dir))2826 self.assertTrue(path_exists(local_dir))
28192827
2820 @defer.inlineCallbacks2828 @defer.inlineCallbacks
2821 def test_make_dir_in_ro_share(self):2829 def test_make_dir_in_ro_share(self):
@@ -2825,7 +2833,7 @@
2825 testdir = os.path.join(share.path, "foo")2833 testdir = os.path.join(share.path, "foo")
2826 mdid = self.fsm.create(testdir, 'ro_share_id', is_dir=True)2834 mdid = self.fsm.create(testdir, 'ro_share_id', is_dir=True)
2827 self.fsm.make_dir(mdid)2835 self.fsm.make_dir(mdid)
2828 self.assertTrue(os.path.exists(testdir))2836 self.assertTrue(path_exists(testdir))
28292837
2830 @defer.inlineCallbacks2838 @defer.inlineCallbacks
2831 def test_make_dir_ro_watch(self):2839 def test_make_dir_ro_watch(self):
@@ -2915,7 +2923,7 @@
2915 self.fsm.CHANGED_SERVER)2923 self.fsm.CHANGED_SERVER)
29162924
2917 # remove the .partial by hand, to see it crash2925 # remove the .partial by hand, to see it crash
2918 os.remove(partial_path)2926 remove_file(partial_path)
2919 # pylint: disable-msg=W02122927 # pylint: disable-msg=W0212
2920 self.assertRaises(InconsistencyError,2928 self.assertRaises(InconsistencyError,
2921 self.fsm._check_partial, mdid=mdid)2929 self.fsm._check_partial, mdid=mdid)
@@ -3060,7 +3068,7 @@
3060 fd = self.fsm.get_partial_for_writing('uuid2', share.volume_id)3068 fd = self.fsm.get_partial_for_writing('uuid2', share.volume_id)
3061 fd.flush()3069 fd.flush()
3062 fd.close()3070 fd.close()
3063 self.assertTrue(os.path.exists(testdir))3071 self.assertTrue(path_exists(testdir))
30643072
3065 @defer.inlineCallbacks3073 @defer.inlineCallbacks
3066 def test_file_ro_share(self):3074 def test_file_ro_share(self):
@@ -3075,7 +3083,7 @@
3075 fd.flush()3083 fd.flush()
3076 fd.close()3084 fd.close()
3077 self.fsm.commit_partial('uuid3', self.share.volume_id, None)3085 self.fsm.commit_partial('uuid3', self.share.volume_id, None)
3078 self.assertTrue(os.path.exists(testfile))3086 self.assertTrue(path_exists(testfile))
30793087
3080 @defer.inlineCallbacks3088 @defer.inlineCallbacks
3081 def test_delete_dir_ro_share(self):3089 def test_delete_dir_ro_share(self):
@@ -3090,9 +3098,9 @@
3090 fd.flush()3098 fd.flush()
3091 fd.close()3099 fd.close()
3092 self.fsm.remove_partial('uuid2', share.volume_id)3100 self.fsm.remove_partial('uuid2', share.volume_id)
3093 self.assertTrue(os.path.exists(testdir))3101 self.assertTrue(path_exists(testdir))
3094 self.fsm.delete_file(testdir)3102 self.fsm.delete_file(testdir)
3095 self.assertFalse(os.path.exists(testdir))3103 self.assertFalse(path_exists(testdir))
30963104
3097 @defer.inlineCallbacks3105 @defer.inlineCallbacks
3098 def test_delete_non_empty_dir_ro_share(self):3106 def test_delete_non_empty_dir_ro_share(self):
@@ -3118,11 +3126,11 @@
3118 fd.close()3126 fd.close()
3119 self.fsm.commit_partial('uuid3', share.volume_id, None)3127 self.fsm.commit_partial('uuid3', share.volume_id, None)
3120 self.fsm.upload_finished(mdid, self.fsm.get_by_mdid(mdid).local_hash)3128 self.fsm.upload_finished(mdid, self.fsm.get_by_mdid(mdid).local_hash)
3121 self.assertTrue(os.path.exists(testdir))3129 self.assertTrue(path_exists(testdir))
3122 self.assertTrue(os.path.exists(testfile))3130 self.assertTrue(path_exists(testfile))
3123 self.fsm.delete_file(testdir)3131 self.fsm.delete_file(testdir)
3124 self.assertFalse(os.path.exists(testdir))3132 self.assertFalse(path_exists(testdir))
3125 self.assertFalse(os.path.exists(testfile))3133 self.assertFalse(path_exists(testfile))
31263134
3127 @defer.inlineCallbacks3135 @defer.inlineCallbacks
3128 def test_delete_non_empty_dir_rw_share(self):3136 def test_delete_non_empty_dir_rw_share(self):
@@ -3148,11 +3156,11 @@
3148 fd.close()3156 fd.close()
3149 self.fsm.commit_partial('uuid3', share.volume_id, None)3157 self.fsm.commit_partial('uuid3', share.volume_id, None)
3150 self.fsm.upload_finished(mdid, self.fsm.get_by_mdid(mdid).local_hash)3158 self.fsm.upload_finished(mdid, self.fsm.get_by_mdid(mdid).local_hash)
3151 self.assertTrue(os.path.exists(testdir))3159 self.assertTrue(path_exists(testdir))
3152 self.assertTrue(os.path.exists(testfile))3160 self.assertTrue(path_exists(testfile))
3153 self.fsm.delete_file(testdir)3161 self.fsm.delete_file(testdir)
3154 self.assertFalse(os.path.exists(testdir))3162 self.assertFalse(path_exists(testdir))
3155 self.assertFalse(os.path.exists(testfile))3163 self.assertFalse(path_exists(testfile))
31563164
3157 @defer.inlineCallbacks3165 @defer.inlineCallbacks
3158 def test_delete_non_empty_dir_bad_perms_rw_share(self):3166 def test_delete_non_empty_dir_bad_perms_rw_share(self):
@@ -3178,16 +3186,18 @@
3178 fd.close()3186 fd.close()
3179 self.fsm.commit_partial('uuid3', share.volume_id, None)3187 self.fsm.commit_partial('uuid3', share.volume_id, None)
3180 self.fsm.upload_finished(mdid, self.fsm.get_by_mdid(mdid).local_hash)3188 self.fsm.upload_finished(mdid, self.fsm.get_by_mdid(mdid).local_hash)
3181 self.assertTrue(os.path.exists(testdir))3189 self.assertTrue(path_exists(testdir))
3182 self.assertTrue(os.path.exists(testfile))3190 self.assertTrue(path_exists(testfile))
31833191
3184 # make the dir read-only, the error should be logged3192 # make the dir read-only, the error should be logged
3185 os.chmod(testdir, 0555)3193 set_dir_readonly(testdir)
3194 self.addCleanup(set_dir_readwrite, testdir)
3195
3186 self.fsm.delete_file(testdir)3196 self.fsm.delete_file(testdir)
3187 self.assertTrue(self.handler.check_warning("OSError", testdir,3197 self.assertTrue(self.handler.check_warning("OSError", testdir,
3188 "when trying to remove"))3198 "when trying to remove"))
3189 self.assertTrue(os.path.exists(testdir))3199 self.assertTrue(path_exists(testdir))
3190 self.assertTrue(os.path.exists(testfile))3200 self.assertTrue(path_exists(testfile))
31913201
3192 @defer.inlineCallbacks3202 @defer.inlineCallbacks
3193 def test_delete_file_ro_share(self):3203 def test_delete_file_ro_share(self):
@@ -3202,9 +3212,9 @@
3202 fd.flush()3212 fd.flush()
3203 fd.close()3213 fd.close()
3204 self.fsm.commit_partial('uuid3', self.share.volume_id, None)3214 self.fsm.commit_partial('uuid3', self.share.volume_id, None)
3205 self.assertTrue(os.path.exists(testfile))3215 self.assertTrue(path_exists(testfile))
3206 self.fsm.delete_file(testfile)3216 self.fsm.delete_file(testfile)
3207 self.assertFalse(os.path.exists(testfile))3217 self.assertFalse(path_exists(testfile))
32083218
3209 @defer.inlineCallbacks3219 @defer.inlineCallbacks
3210 def test_move_to_conflict_ro_share(self):3220 def test_move_to_conflict_ro_share(self):
@@ -3220,9 +3230,9 @@
3220 fd.flush()3230 fd.flush()
3221 fd.close()3231 fd.close()
3222 self.fsm.commit_partial('uuid3', self.share.volume_id, None)3232 self.fsm.commit_partial('uuid3', self.share.volume_id, None)
3223 self.assertTrue(os.path.exists(testfile))3233 self.assertTrue(path_exists(testfile))
3224 self.fsm.move_to_conflict(file_mdid)3234 self.fsm.move_to_conflict(file_mdid)
3225 self.assertTrue(os.path.exists(testfile + self.fsm.CONFLICT_SUFFIX))3235 self.assertTrue(path_exists(testfile + self.fsm.CONFLICT_SUFFIX))
32263236
3227 @defer.inlineCallbacks3237 @defer.inlineCallbacks
3228 def test_file_rw_share_no_fail(self):3238 def test_file_rw_share_no_fail(self):
@@ -3230,7 +3240,7 @@
3230 share = yield self.create_share('ro_share', 'ro_share_name')3240 share = yield self.create_share('ro_share', 'ro_share_name')
3231 testfile = os.path.join(share.path, "a_file")3241 testfile = os.path.join(share.path, "a_file")
3232 open(testfile, 'w').close()3242 open(testfile, 'w').close()
3233 self.assertTrue(os.path.exists(testfile))3243 self.assertTrue(path_exists(testfile))
32343244
3235 @defer.inlineCallbacks3245 @defer.inlineCallbacks
3236 def test_dir_rw_share(self):3246 def test_dir_rw_share(self):
@@ -3243,7 +3253,7 @@
3243 fd = self.fsm.get_partial_for_writing('uuid2', share.volume_id)3253 fd = self.fsm.get_partial_for_writing('uuid2', share.volume_id)
3244 fd.flush()3254 fd.flush()
3245 fd.close()3255 fd.close()
3246 self.assertTrue(os.path.exists(testdir))3256 self.assertTrue(path_exists(testdir))
32473257
3248 @defer.inlineCallbacks3258 @defer.inlineCallbacks
3249 def test_file_rw_share(self):3259 def test_file_rw_share(self):
@@ -3257,7 +3267,7 @@
3257 fd.flush()3267 fd.flush()
3258 fd.close()3268 fd.close()
3259 self.fsm.commit_partial('uuid3', self.share.volume_id, None)3269 self.fsm.commit_partial('uuid3', self.share.volume_id, None)
3260 self.assertTrue(os.path.exists(testfile))3270 self.assertTrue(path_exists(testfile))
32613271
3262 def test_share_and_root(self):3272 def test_share_and_root(self):
3263 """ Test the creation of a file with the same relative path in a share3273 """ Test the creation of a file with the same relative path in a share
@@ -3277,8 +3287,8 @@
3277 fd = self.fsm.get_partial_for_writing('uuid2', self.share.volume_id)3287 fd = self.fsm.get_partial_for_writing('uuid2', self.share.volume_id)
3278 fd.flush()3288 fd.flush()
3279 fd.close()3289 fd.close()
3280 self.assertTrue(os.path.exists(self.fsm.get_abspath("", a_dir_root)))3290 self.assertTrue(path_exists(self.fsm.get_abspath("", a_dir_root)))
3281 self.assertTrue(os.path.exists(a_dir_share))3291 self.assertTrue(path_exists(a_dir_share))
32823292
32833293
3284class TestEnableShareWrite(FSMTestCase):3294class TestEnableShareWrite(FSMTestCase):
@@ -3388,7 +3398,7 @@
33883398
3389 # delete the version that should have left the previous fsm3399 # delete the version that should have left the previous fsm
3390 version_file = os.path.join(self.data_dir, "metadata_version")3400 version_file = os.path.join(self.data_dir, "metadata_version")
3391 os.remove(version_file)3401 remove_file(version_file)
33923402
3393 # create a old-style fs with the data:3403 # create a old-style fs with the data:
3394 old_fs = FileShelf(self.fsm.old_fs._path)3404 old_fs = FileShelf(self.fsm.old_fs._path)
33953405
=== modified file 'tests/syncdaemon/test_localrescan.py'
--- tests/syncdaemon/test_localrescan.py 2011-08-08 20:22:25 +0000
+++ tests/syncdaemon/test_localrescan.py 2011-08-09 16:37:30 +0000
@@ -28,7 +28,7 @@
2828
29from contrib.testing import testcase29from contrib.testing import testcase
30from ubuntuone.devtools.handlers import MementoHandler30from ubuntuone.devtools.handlers import MementoHandler
31from ubuntuone.platform import make_link31from ubuntuone.platform import make_link, remove_file, remove_dir, rename
32from ubuntuone.syncdaemon import local_rescan32from ubuntuone.syncdaemon import local_rescan
33from ubuntuone.syncdaemon.marker import MDMarker33from ubuntuone.syncdaemon.marker import MDMarker
34from ubuntuone.syncdaemon.tritcask import Tritcask34from ubuntuone.syncdaemon.tritcask import Tritcask
@@ -1019,7 +1019,7 @@
1019 self.create_node("x", is_dir=False)1019 self.create_node("x", is_dir=False)
10201020
1021 # move the second into the first one1021 # move the second into the first one
1022 os.rename(pathy, pathx)1022 rename(pathy, pathx)
10231023
1024 # a & m times will be the same, but not the inode or change time1024 # a & m times will be the same, but not the inode or change time
1025 def check(_):1025 def check(_):
@@ -1117,9 +1117,9 @@
11171117
1118 # remove a couple, create some new1118 # remove a couple, create some new
1119 sh1 = os.path.join(self.share.path, "d")1119 sh1 = os.path.join(self.share.path, "d")
1120 os.remove(sh1)1120 remove_file(sh1)
1121 sh2 = os.path.join(self.share.path, "f")1121 sh2 = os.path.join(self.share.path, "f")
1122 os.remove(sh2)1122 remove_file(sh2)
1123 sh3 = os.path.join(self.share.path, "jj")1123 sh3 = os.path.join(self.share.path, "jj")
1124 open(sh3, "w").close()1124 open(sh3, "w").close()
1125 sh4 = os.path.join(self.share.path, "kk")1125 sh4 = os.path.join(self.share.path, "kk")
@@ -1243,7 +1243,7 @@
1243 for c in "abcdefgh":1243 for c in "abcdefgh":
1244 self.create_node(c, is_dir=False, which_share=self.share1)1244 self.create_node(c, is_dir=False, which_share=self.share1)
1245 sh1 = os.path.join(self.share1.path, "d")1245 sh1 = os.path.join(self.share1.path, "d")
1246 os.remove(sh1)1246 remove_file(sh1)
1247 sh2 = os.path.join(self.share1.path, "jj")1247 sh2 = os.path.join(self.share1.path, "jj")
1248 open(sh2, "w").close()1248 open(sh2, "w").close()
12491249
@@ -1251,7 +1251,7 @@
1251 for c in "abcdefgh":1251 for c in "abcdefgh":
1252 self.create_node(c, is_dir=False, which_share=self.share2)1252 self.create_node(c, is_dir=False, which_share=self.share2)
1253 sh3 = os.path.join(self.share2.path, "e")1253 sh3 = os.path.join(self.share2.path, "e")
1254 os.remove(sh3)1254 remove_file(sh3)
1255 sh4 = os.path.join(self.share2.path, "kk")1255 sh4 = os.path.join(self.share2.path, "kk")
1256 open(sh4, "w").close()1256 open(sh4, "w").close()
12571257
@@ -1765,7 +1765,7 @@
1765 self.fsm.create_partial("uuid", self.share.volume_id)1765 self.fsm.create_partial("uuid", self.share.volume_id)
17661766
1767 # now, for some reason, we lose the partial file1767 # now, for some reason, we lose the partial file
1768 os.remove(partial_path)1768 remove_file(partial_path)
17691769
1770 def check(_):1770 def check(_):
1771 """Compare predictable args, and check fh factory."""1771 """Compare predictable args, and check fh factory."""
@@ -1921,7 +1921,7 @@
19211921
19221922
1923 # now change the dir for a file, for LR to find it1923 # now change the dir for a file, for LR to find it
1924 os.rmdir(path)1924 remove_dir(path)
1925 open(path, "w").close()1925 open(path, "w").close()
19261926
1927 def check(_):1927 def check(_):
19281928
=== modified file 'tests/syncdaemon/test_main.py'
--- tests/syncdaemon/test_main.py 2011-08-03 21:41:45 +0000
+++ tests/syncdaemon/test_main.py 2011-08-09 16:37:30 +0000
@@ -28,7 +28,12 @@
28)28)
29from tests.platform import setup_main_test, get_main_params29from tests.platform import setup_main_test, get_main_params
30from ubuntuone.clientdefs import VERSION30from ubuntuone.clientdefs import VERSION
31from ubuntuone.platform import make_link31from ubuntuone.platform import (
32 is_link,
33 make_link,
34 path_exists,
35 remove_dir,
36)
32from ubuntuone.syncdaemon import main as main_mod37from ubuntuone.syncdaemon import main as main_mod
3338
3439
@@ -148,13 +153,13 @@
148 def test_create_dirs_already_exists_dirs(self):153 def test_create_dirs_already_exists_dirs(self):
149 """test that creating a Main instance works as expected."""154 """test that creating a Main instance works as expected."""
150 link = os.path.join(self.root, 'Shared With Me')155 link = os.path.join(self.root, 'Shared With Me')
151 self.assertFalse(os.path.exists(link))156 self.assertFalse(path_exists(link))
152 self.assertTrue(os.path.exists(self.shares))157 self.assertTrue(path_exists(self.shares))
153 self.assertTrue(os.path.exists(self.root))158 self.assertTrue(path_exists(self.root))
154 main = self.build_main()159 main = self.build_main()
155 self.assertTrue(os.path.exists(main.shares_dir_link))160 self.assertTrue(path_exists(main.shares_dir_link))
156 # check that the shares link is actually a link161 # check that the shares link is actually a link
157 self.assertTrue(os.path.islink(main.shares_dir_link))162 self.assertTrue(is_link(main.shares_dir_link))
158 self.assertEquals(link, main.shares_dir_link)163 self.assertEquals(link, main.shares_dir_link)
159 main.shutdown()164 main.shutdown()
160165
@@ -162,41 +167,41 @@
162 """test that creating a Main instance works as expected."""167 """test that creating a Main instance works as expected."""
163 link = os.path.join(self.root, 'Shared With Me')168 link = os.path.join(self.root, 'Shared With Me')
164 make_link(self.shares, link)169 make_link(self.shares, link)
165 self.assertTrue(os.path.exists(link))170 self.assertTrue(path_exists(link))
166 self.assertTrue(os.path.islink(link))171 self.assertTrue(is_link(link))
167 self.assertTrue(os.path.exists(self.shares))172 self.assertTrue(path_exists(self.shares))
168 self.assertTrue(os.path.exists(self.root))173 self.assertTrue(path_exists(self.root))
169 main = self.build_main()174 main = self.build_main()
170 # check that the shares link is actually a link175 # check that the shares link is actually a link
171 self.assertTrue(os.path.islink(main.shares_dir_link))176 self.assertTrue(is_link(main.shares_dir_link))
172 main.shutdown()177 main.shutdown()
173178
174 def test_create_dirs_already_exists_but_not_symlink(self):179 def test_create_dirs_already_exists_but_not_symlink(self):
175 """test that creating a Main instance works as expected."""180 """test that creating a Main instance works as expected."""
176 link = os.path.join(self.root, 'Shared With Me')181 link = os.path.join(self.root, 'Shared With Me')
177 os.makedirs(link)182 os.makedirs(link)
178 self.assertTrue(os.path.exists(link))183 self.assertTrue(path_exists(link))
179 self.assertFalse(os.path.islink(link))184 self.assertFalse(is_link(link))
180 self.assertTrue(os.path.exists(self.shares))185 self.assertTrue(path_exists(self.shares))
181 self.assertTrue(os.path.exists(self.root))186 self.assertTrue(path_exists(self.root))
182 main = self.build_main()187 main = self.build_main()
183 # check that the shares link is actually a link188 # check that the shares link is actually a link
184 self.assertEquals(main.shares_dir_link, link)189 self.assertEquals(main.shares_dir_link, link)
185 self.assertFalse(os.path.islink(main.shares_dir_link))190 self.assertFalse(is_link(main.shares_dir_link))
186 main.shutdown()191 main.shutdown()
187192
188 def test_create_dirs_none_exists(self):193 def test_create_dirs_none_exists(self):
189 """test that creating a Main instance works as expected."""194 """test that creating a Main instance works as expected."""
190 link = os.path.join(self.root, 'Shared With Me')195 link = os.path.join(self.root, 'Shared With Me')
191 # remove the existing dirs196 # remove the existing dirs
192 os.rmdir(self.root)197 remove_dir(self.root)
193 os.rmdir(self.shares)198 remove_dir(self.shares)
194 main = self.build_main()199 main = self.build_main()
195 # check that the shares link is actually a link200 # check that the shares link is actually a link
196 self.assertTrue(os.path.exists(link))201 self.assertTrue(path_exists(link))
197 self.assertTrue(os.path.islink(main.shares_dir_link))202 self.assertTrue(is_link(main.shares_dir_link))
198 self.assertTrue(os.path.exists(self.shares))203 self.assertTrue(path_exists(self.shares))
199 self.assertTrue(os.path.exists(self.root))204 self.assertTrue(path_exists(self.root))
200 main.shutdown()205 main.shutdown()
201206
202 def test_connect_if_autoconnect_is_enabled(self):207 def test_connect_if_autoconnect_is_enabled(self):
203208
=== modified file 'tests/syncdaemon/test_sync.py'
--- tests/syncdaemon/test_sync.py 2011-08-03 20:59:59 +0000
+++ tests/syncdaemon/test_sync.py 2011-08-09 16:37:30 +0000
@@ -43,6 +43,7 @@
43from ubuntuone.platform import (43from ubuntuone.platform import (
44 make_dir,44 make_dir,
45 open_file,45 open_file,
46 remove_file,
46 stat_path,47 stat_path,
47)48)
48from ubuntuone.syncdaemon.filesystem_manager import FileSystemManager49from ubuntuone.syncdaemon.filesystem_manager import FileSystemManager
@@ -228,14 +229,14 @@
228 self.main = FakeMain(root_dir=self.root, shares_dir=self.shares,229 self.main = FakeMain(root_dir=self.root, shares_dir=self.shares,
229 data_dir=self.data,230 data_dir=self.data,
230 partials_dir=self.partials_dir)231 partials_dir=self.partials_dir)
232 self.addCleanup(self.main.shutdown)
231 self._logger = logging.getLogger('ubuntuone.SyncDaemon')233 self._logger = logging.getLogger('ubuntuone.SyncDaemon')
232 self._logger.addHandler(self.handler)234 self._logger.addHandler(self.handler)
235 self.addCleanup(self._logger.removeHandler, self.handler)
233236
234 @defer.inlineCallbacks237 @defer.inlineCallbacks
235 def tearDown(self):238 def tearDown(self):
236 """Clean up."""239 """Clean up."""
237 self._logger.removeHandler(self.handler)
238 self.main.shutdown()
239 FakeMain._sync_class = None240 FakeMain._sync_class = None
240 for record in self.handler.records:241 for record in self.handler.records:
241 exc_info = getattr(record, 'exc_info', None)242 exc_info = getattr(record, 'exc_info', None)
@@ -811,7 +812,7 @@
811 # create the partial correctly, and break it!812 # create the partial correctly, and break it!
812 self.fsm.create_partial('node_id', '')813 self.fsm.create_partial('node_id', '')
813 partial_path = self.fsm._get_partial_path(self.fsm.fs[self.mdid])814 partial_path = self.fsm._get_partial_path(self.fsm.fs[self.mdid])
814 os.remove(partial_path)815 remove_file(partial_path)
815816
816 # event!817 # event!
817 self.ssmr.commit_file('AQ_DOWNLOAD_COMMIT', None, 'hash')818 self.ssmr.commit_file('AQ_DOWNLOAD_COMMIT', None, 'hash')
818819
=== modified file 'tests/syncdaemon/test_vm.py'
--- tests/syncdaemon/test_vm.py 2011-08-05 10:56:06 +0000
+++ tests/syncdaemon/test_vm.py 2011-08-09 16:37:30 +0000
@@ -63,6 +63,9 @@
63 make_dir,63 make_dir,
64 path_exists,64 path_exists,
65 remove_link,65 remove_link,
66 rename,
67 set_dir_readonly,
68 set_dir_readwrite,
66)69)
6770
68# grab the metadata version before tests fiddle with it71# grab the metadata version before tests fiddle with it
@@ -918,7 +921,7 @@
918 self.main.fs.set_node_id(path, 'dir_node_id')921 self.main.fs.set_node_id(path, 'dir_node_id')
919 yield self.vm._add_watch(path)922 yield self.vm._add_watch(path)
920923
921 os.rename(path, path + '.old')924 rename(path, path + '.old')
922 # remove the watches925 # remove the watches
923 self.vm._remove_watches(self.root_dir)926 self.vm._remove_watches(self.root_dir)
924927
@@ -3774,8 +3777,10 @@
3774 make_dir(os.path.join(self.root_dir, 'My Files'),recursive=True)3777 make_dir(os.path.join(self.root_dir, 'My Files'),recursive=True)
3775 shares_dir = os.path.join(self.root_dir, 'Shared With Me')3778 shares_dir = os.path.join(self.root_dir, 'Shared With Me')
3776 make_dir(shares_dir, recursive=True)3779 make_dir(shares_dir, recursive=True)
3777 os.chmod(self.root_dir, 0500)3780 set_dir_readonly(self.root_dir)
3778 os.chmod(shares_dir, 0500)3781 self.addCleanup(set_dir_readwrite, self.root_dir)
3782 set_dir_readonly(shares_dir)
3783 self.addCleanup(set_dir_readwrite, shares_dir)
3779 version = self.md_upgrader._guess_metadata_version()3784 version = self.md_upgrader._guess_metadata_version()
3780 self.assertEquals(None, version)3785 self.assertEquals(None, version)
37813786
@@ -3789,8 +3794,10 @@
3789 shares_dir = os.path.join(self.root_dir, 'Shared With Me')3794 shares_dir = os.path.join(self.root_dir, 'Shared With Me')
3790 remove_link(shares_dir)3795 remove_link(shares_dir)
3791 make_dir(shares_dir, recursive=True)3796 make_dir(shares_dir, recursive=True)
3792 os.chmod(self.root_dir, 0500)3797 set_dir_readonly(self.root_dir)
3793 os.chmod(shares_dir, 0500)3798 self.addCleanup(set_dir_readwrite, self.root_dir)
3799 set_dir_readonly(shares_dir)
3800 self.addCleanup(set_dir_readwrite, shares_dir)
3794 self.rmtree(self.shares_dir)3801 self.rmtree(self.shares_dir)
3795 version = self.md_upgrader._guess_metadata_version()3802 version = self.md_upgrader._guess_metadata_version()
3796 self.assertIn(version, ['1', '2'])3803 self.assertIn(version, ['1', '2'])
@@ -3839,8 +3846,7 @@
3839 dirpath = os.path.join('path', 'to', 'metadata')3846 dirpath = os.path.join('path', 'to', 'metadata')
3840 files = ['not_yet.partial', ]3847 files = ['not_yet.partial', ]
3841 mocker = Mocker()3848 mocker = Mocker()
3842 # ensure that we do use the platform method and not the3849 # ensure that we do use the platform method and not the renamed one
3843 # os.rename one
3844 os_helper_rename = mocker.replace('ubuntuone.platform.rename')3850 os_helper_rename = mocker.replace('ubuntuone.platform.rename')
3845 is_string = lambda x: isinstance(x, str)3851 is_string = lambda x: isinstance(x, str)
3846 os_helper_rename(MATCH(is_string), MATCH(is_string))3852 os_helper_rename(MATCH(is_string), MATCH(is_string))
@@ -3853,8 +3859,7 @@
3853 shelf['foobar'] = _Share(path=os.path.join('foo','bar'),3859 shelf['foobar'] = _Share(path=os.path.join('foo','bar'),
3854 share_id='foobar')3860 share_id='foobar')
3855 mocker = Mocker()3861 mocker = Mocker()
3856 # ensure that we do use the platform method and not the3862 # ensure that we do use the platform method and not the renamed one
3857 # os.rename one
3858 self.md_upgrader._upgrade_metadata_6 = mocker.mock()3863 self.md_upgrader._upgrade_metadata_6 = mocker.mock()
3859 os_helper_rename = mocker.replace('ubuntuone.platform.rename')3864 os_helper_rename = mocker.replace('ubuntuone.platform.rename')
3860 is_string = lambda x: isinstance(x, str)3865 is_string = lambda x: isinstance(x, str)
38613866
=== modified file 'ubuntuone/platform/linux/filesystem_notifications.py'
--- ubuntuone/platform/linux/filesystem_notifications.py 2011-07-28 22:21:07 +0000
+++ ubuntuone/platform/linux/filesystem_notifications.py 2011-08-09 16:37:30 +0000
@@ -24,9 +24,6 @@
24import pyinotify24import pyinotify
25from twisted.internet import abstract, reactor, error, defer25from twisted.internet import abstract, reactor, error, defer
2626
27from ubuntuone.syncdaemon.filesystem_notifications import (
28 GeneralINotifyProcessor
29)
3027
31# translates quickly the event and it's is_dir state to our standard events28# translates quickly the event and it's is_dir state to our standard events
32NAME_TRANSLATIONS = {29NAME_TRANSLATIONS = {
@@ -152,6 +149,10 @@
152 FS_(DIR|FILE)_MOVE event when possible.149 FS_(DIR|FILE)_MOVE event when possible.
153 """150 """
154 def __init__(self, monitor, ignore_config=None):151 def __init__(self, monitor, ignore_config=None):
152 # XXX: avoid circular imports
153 from ubuntuone.syncdaemon.filesystem_notifications import (
154 GeneralINotifyProcessor
155 )
155 self.general_processor = GeneralINotifyProcessor(monitor,156 self.general_processor = GeneralINotifyProcessor(monitor,
156 self.handle_dir_delete, NAME_TRANSLATIONS,157 self.handle_dir_delete, NAME_TRANSLATIONS,
157 self.platform_is_ignored, pyinotify.IN_IGNORED,158 self.platform_is_ignored, pyinotify.IN_IGNORED,
158159
=== modified file 'ubuntuone/platform/windows/filesystem_notifications.py'
--- ubuntuone/platform/windows/filesystem_notifications.py 2011-08-04 21:45:04 +0000
+++ ubuntuone/platform/windows/filesystem_notifications.py 2011-08-09 16:37:30 +0000
@@ -63,8 +63,6 @@
63 IN_MOVED_FROM,63 IN_MOVED_FROM,
64 IN_MOVED_TO,64 IN_MOVED_TO,
65 IN_MODIFY)65 IN_MODIFY)
66from ubuntuone.syncdaemon.filesystem_notifications import (
67 GeneralINotifyProcessor)
68from ubuntuone.platform.windows.os_helper import (66from ubuntuone.platform.windows.os_helper import (
69 is_valid_syncdaemon_path,67 is_valid_syncdaemon_path,
70 is_valid_windows_path,68 is_valid_windows_path,
@@ -471,6 +469,10 @@
471 """469 """
472470
473 def __init__(self, monitor, ignore_config=None):471 def __init__(self, monitor, ignore_config=None):
472 # XXX: avoid circular imports.
473 from ubuntuone.syncdaemon.filesystem_notifications import (
474 GeneralINotifyProcessor
475 )
474 self.general_processor = GeneralINotifyProcessor(monitor,476 self.general_processor = GeneralINotifyProcessor(monitor,
475 self.handle_dir_delete, NAME_TRANSLATIONS,477 self.handle_dir_delete, NAME_TRANSLATIONS,
476 self.platform_is_ignored, IN_IGNORED, ignore_config=ignore_config)478 self.platform_is_ignored, IN_IGNORED, ignore_config=ignore_config)
477479
=== modified file 'ubuntuone/syncdaemon/file_shelf.py'
--- ubuntuone/syncdaemon/file_shelf.py 2011-08-05 15:17:28 +0000
+++ ubuntuone/syncdaemon/file_shelf.py 2011-08-09 16:37:30 +0000
@@ -19,14 +19,23 @@
19"""storage shelf using a files tree."""19"""storage shelf using a files tree."""
2020
21from __future__ import with_statement21from __future__ import with_statement
22from UserDict import DictMixin22
23import cPickle23import cPickle
24import os24import os
25import stat25import stat
26import errno26import errno
27
27from collections import deque28from collections import deque
2829from UserDict import DictMixin
29from ubuntuone.platform import make_dir, open_file, remove_file, rename, stat_path30
31from ubuntuone.platform import (
32 make_dir,
33 open_file,
34 remove_file,
35 rename,
36 stat_path,
37)
38
3039
31class FileShelf(object, DictMixin):40class FileShelf(object, DictMixin):
32 """ File based shelf.41 """ File based shelf.
3342
=== modified file 'ubuntuone/syncdaemon/filesystem_manager.py'
--- ubuntuone/syncdaemon/filesystem_manager.py 2011-07-28 15:43:05 +0000
+++ ubuntuone/syncdaemon/filesystem_manager.py 2011-08-09 16:37:30 +0000
@@ -1558,7 +1558,7 @@
1558 set_file_readonly(self.path)1558 set_file_readonly(self.path)
15591559
1560 # restore all saved ones1560 # restore all saved ones
1561 exists = os.path.exists1561 exists = path_exists
1562 for path, isdir in self._changed_nodes[::-1]:1562 for path, isdir in self._changed_nodes[::-1]:
1563 if exists(path):1563 if exists(path):
1564 if isdir:1564 if isdir:
15651565
=== modified file 'ubuntuone/syncdaemon/filesystem_notifications.py'
--- ubuntuone/syncdaemon/filesystem_notifications.py 2011-04-20 09:13:43 +0000
+++ ubuntuone/syncdaemon/filesystem_notifications.py 2011-08-09 16:37:30 +0000
@@ -19,6 +19,7 @@
19import os19import os
20import re20import re
2121
22from ubuntuone.platform import path_exists
22from ubuntuone.syncdaemon.mute_filter import MuteFilter23from ubuntuone.syncdaemon.mute_filter import MuteFilter
23from ubuntuone import logger24from ubuntuone import logger
24# our logging level25# our logging level
@@ -96,7 +97,7 @@
96 # check first if the platform code knows hat to do with it97 # check first if the platform code knows hat to do with it
97 if not self.platform_is_ignored(path):98 if not self.platform_is_ignored(path):
98 # check if we can read99 # check if we can read
99 if os.path.exists(path) and not os.access(path, os.R_OK):100 if path_exists(path) and not os.access(path, os.R_OK):
100 self.log.warning("Ignoring path as we don't have enough "101 self.log.warning("Ignoring path as we don't have enough "
101 "permissions to track it: %r", path)102 "permissions to track it: %r", path)
102 return True103 return True
103104
=== modified file 'ubuntuone/syncdaemon/local_rescan.py'
--- ubuntuone/syncdaemon/local_rescan.py 2011-06-24 20:24:51 +0000
+++ ubuntuone/syncdaemon/local_rescan.py 2011-08-09 16:37:30 +0000
@@ -205,7 +205,7 @@
205 log_error("The received path is not in any share!")205 log_error("The received path is not in any share!")
206 raise ValueError("The received path is not in any share!")206 raise ValueError("The received path is not in any share!")
207207
208 # uglier than os.path.exists and isdir, but only hit the disk once208 # uglier than path_exists and isdir, but only hit the disk once
209 stat_result = get_stat(direct)209 stat_result = get_stat(direct)
210 if stat_result is None:210 if stat_result is None:
211 m = "The received path is not in disk: path %r mdid %s"211 m = "The received path is not in disk: path %r mdid %s"
212212
=== modified file 'ubuntuone/syncdaemon/vm_helper.py'
--- ubuntuone/syncdaemon/vm_helper.py 2011-08-03 20:44:10 +0000
+++ ubuntuone/syncdaemon/vm_helper.py 2011-08-09 16:37:30 +0000
@@ -27,6 +27,7 @@
27 make_link,27 make_link,
28 path_exists,28 path_exists,
29 read_link,29 read_link,
30 remove_file,
30)31)
3132
3233
@@ -70,7 +71,7 @@
70 if not path_exists(dest):71 if not path_exists(dest):
71 # remove the symlink if it's broken72 # remove the symlink if it's broken
72 if is_link(dest) and read_link(dest) != source:73 if is_link(dest) and read_link(dest) != source:
73 os.remove(dest)74 remove_file(dest)
74 make_link(source, dest)75 make_link(source, dest)
75 return True76 return True
76 else:77 else:
7778
=== modified file 'ubuntuone/syncdaemon/volume_manager.py'
--- ubuntuone/syncdaemon/volume_manager.py 2011-08-03 20:20:02 +0000
+++ ubuntuone/syncdaemon/volume_manager.py 2011-08-09 16:37:30 +0000
@@ -57,6 +57,8 @@
57 normpath,57 normpath,
58 path_exists,58 path_exists,
59 read_link,59 read_link,
60 remove_file,
61 remove_dir,
60 rename,62 rename,
61 set_dir_readonly,63 set_dir_readonly,
62 set_dir_readwrite,64 set_dir_readwrite,
@@ -68,8 +70,6 @@
68UDF_ROW_TYPE = 570UDF_ROW_TYPE = 5
6971
7072
71
72
73class _Share(object):73class _Share(object):
74 """Represents a share or mount point"""74 """Represents a share or mount point"""
7575
@@ -1434,12 +1434,12 @@
14341434
1435 def _get_md_version(self):1435 def _get_md_version(self):
1436 """Returns the current md_version"""1436 """Returns the current md_version"""
1437 if not os.path.exists(self._data_dir):1437 if not path_exists(self._data_dir):
1438 # first run, the data dir don't exist. No metadata to upgrade1438 # first run, the data dir don't exist. No metadata to upgrade
1439 md_version = VolumeManager.METADATA_VERSION1439 md_version = VolumeManager.METADATA_VERSION
1440 os.makedirs(self._data_dir)1440 os.makedirs(self._data_dir)
1441 self.update_metadata_version()1441 self.update_metadata_version()
1442 elif os.path.exists(self._version_file):1442 elif path_exists(self._version_file):
1443 with open(self._version_file) as fh:1443 with open(self._version_file) as fh:
1444 md_version = fh.read().strip()1444 md_version = fh.read().strip()
1445 if not md_version:1445 if not md_version:
@@ -1454,7 +1454,7 @@
14541454
1455 def update_metadata_version(self):1455 def update_metadata_version(self):
1456 """Write the version of the metadata."""1456 """Write the version of the metadata."""
1457 if not os.path.exists(os.path.dirname(self._version_file)):1457 if not path_exists(os.path.dirname(self._version_file)):
1458 os.makedirs(os.path.dirname(self._version_file))1458 os.makedirs(os.path.dirname(self._version_file))
1459 with open(self._version_file, 'w') as fd:1459 with open(self._version_file, 'w') as fd:
1460 fd.write(VolumeManager.METADATA_VERSION)1460 fd.write(VolumeManager.METADATA_VERSION)
@@ -1468,14 +1468,14 @@
14681468
1469 """1469 """
1470 md_version = None1470 md_version = None
1471 if os.path.exists(self._shares_md_dir) \1471 if path_exists(self._shares_md_dir) \
1472 and os.path.exists(self._shared_md_dir):1472 and path_exists(self._shared_md_dir):
1473 # we have shares and shared dirs1473 # we have shares and shared dirs
1474 # md_version >= 11474 # md_version >= 1
1475 old_root_dir = os.path.abspath(os.path.join(self._root_dir, 'My Files'))1475 old_root_dir = os.path.abspath(os.path.join(self._root_dir, 'My Files'))
1476 old_share_dir = os.path.abspath(os.path.join(self._root_dir,1476 old_share_dir = os.path.abspath(os.path.join(self._root_dir,
1477 'Shared With Me'))1477 'Shared With Me'))
1478 if os.path.exists(old_share_dir) and os.path.exists(old_root_dir) \1478 if path_exists(old_share_dir) and path_exists(old_root_dir) \
1479 and not is_link(old_share_dir):1479 and not is_link(old_share_dir):
1480 # md >= 1 and <= 31480 # md >= 1 and <= 3
1481 # we have a My Files dir, 'Shared With Me' isn't a1481 # we have a My Files dir, 'Shared With Me' isn't a
@@ -1524,7 +1524,7 @@
1524 # the shelf already exists, and don't have a .version file1524 # the shelf already exists, and don't have a .version file
1525 # first backup the old data1525 # first backup the old data
1526 backup = os.path.join(self._data_dir, '0.bkp')1526 backup = os.path.join(self._data_dir, '0.bkp')
1527 if not os.path.exists(backup):1527 if not path_exists(backup):
1528 os.makedirs(backup)1528 os.makedirs(backup)
1529 # pylint: disable-msg=W06121529 # pylint: disable-msg=W0612
1530 # filter 'shares' and 'shared' dirs, in case we are in the case of1530 # filter 'shares' and 'shared' dirs, in case we are in the case of
@@ -1539,7 +1539,7 @@
1539 os.path.join(backup, dir))1539 os.path.join(backup, dir))
1540 # regenerate the shelf using the new layout using the backup as src1540 # regenerate the shelf using the new layout using the backup as src
1541 old_shelf = LegacyShareFileShelf(backup)1541 old_shelf = LegacyShareFileShelf(backup)
1542 if not os.path.exists(self._shares_dir):1542 if not path_exists(self._shares_dir):
1543 os.makedirs(self._shares_dir)1543 os.makedirs(self._shares_dir)
1544 new_shelf = LegacyShareFileShelf(self._shares_md_dir)1544 new_shelf = LegacyShareFileShelf(self._shares_md_dir)
1545 for key, share in old_shelf.iteritems():1545 for key, share in old_shelf.iteritems():
@@ -1629,19 +1629,19 @@
1629 old_share_dir = os.path.join(self._root_dir, 'Shared With Me')1629 old_share_dir = os.path.join(self._root_dir, 'Shared With Me')
1630 old_root_dir = os.path.join(self._root_dir, 'My Files')1630 old_root_dir = os.path.join(self._root_dir, 'My Files')
1631 # change permissions1631 # change permissions
1632 os.chmod(self._root_dir, 0775)1632 set_dir_readwrite(self._root_dir)
16331633
1634 def move(src, dst):1634 def move(src, dst):
1635 """Move a file/dir taking care if it's read-only."""1635 """Move a file/dir taking care if it's read-only."""
1636 prev_mode = stat.S_IMODE(os.stat(src).st_mode)1636 prev_mode = stat.S_IMODE(os.stat(src).st_mode)
1637 os.chmod(src, 0755)1637 set_dir_readwrite(src)
1638 shutil.move(src, dst)1638 shutil.move(src, dst)
1639 os.chmod(dst, prev_mode)1639 os.chmod(dst, prev_mode)
16401640
1641 # update the path's in metadata and move the folder1641 # update the path's in metadata and move the folder
1642 if os.path.exists(old_share_dir) and not is_link(old_share_dir):1642 if path_exists(old_share_dir) and not is_link(old_share_dir):
1643 os.chmod(old_share_dir, 0775)1643 set_dir_readwrite(old_share_dir)
1644 if not os.path.exists(os.path.dirname(self._shares_dir)):1644 if not path_exists(os.path.dirname(self._shares_dir)):
1645 os.makedirs(os.path.dirname(self._shares_dir))1645 os.makedirs(os.path.dirname(self._shares_dir))
1646 self.log.debug('moving shares dir from: %r to %r',1646 self.log.debug('moving shares dir from: %r to %r',
1647 old_share_dir, self._shares_dir)1647 old_share_dir, self._shares_dir)
@@ -1649,7 +1649,7 @@
1649 src = os.path.join(old_share_dir, path)1649 src = os.path.join(old_share_dir, path)
1650 dst = os.path.join(self._shares_dir, path)1650 dst = os.path.join(self._shares_dir, path)
1651 move(src, dst)1651 move(src, dst)
1652 os.rmdir(old_share_dir)1652 remove_dir(old_share_dir)
16531653
1654 # update the shares metadata1654 # update the shares metadata
1655 shares = LegacyShareFileShelf(self._shares_md_dir)1655 shares = LegacyShareFileShelf(self._shares_md_dir)
@@ -1670,25 +1670,25 @@
1670 shared[key] = share1670 shared[key] = share
1671 # move the My Files contents, taking care of dir/files with the same1671 # move the My Files contents, taking care of dir/files with the same
1672 # name in the new root1672 # name in the new root
1673 if os.path.exists(old_root_dir):1673 if path_exists(old_root_dir):
1674 self.log.debug('moving My Files contents to the root')1674 self.log.debug('moving My Files contents to the root')
1675 # make My Files rw1675 # make My Files rw
1676 os.chmod(old_root_dir, 0775)1676 set_dir_readwrite(old_root_dir)
1677 path_join = os.path.join1677 path_join = os.path.join
1678 for relpath in listdir(old_root_dir):1678 for relpath in listdir(old_root_dir):
1679 old_path = path_join(old_root_dir, relpath)1679 old_path = path_join(old_root_dir, relpath)
1680 new_path = path_join(self._root_dir, relpath)1680 new_path = path_join(self._root_dir, relpath)
1681 if os.path.exists(new_path):1681 if path_exists(new_path):
1682 shutil.move(new_path, new_path+'.u1conflict')1682 shutil.move(new_path, new_path+'.u1conflict')
1683 if relpath == 'Shared With Me':1683 if relpath == 'Shared With Me':
1684 # remove the Shared with Me symlink inside My Files!1684 # remove the Shared with Me symlink inside My Files!
1685 self.log.debug('removing shares symlink from old root')1685 self.log.debug('removing shares symlink from old root')
1686 os.remove(old_path)1686 remove_file(old_path)
1687 else:1687 else:
1688 self.log.debug('moving %r to %r', old_path, new_path)1688 self.log.debug('moving %r to %r', old_path, new_path)
1689 move(old_path, new_path)1689 move(old_path, new_path)
1690 self.log.debug('removing old root: %r', old_root_dir)1690 self.log.debug('removing old root: %r', old_root_dir)
1691 os.rmdir(old_root_dir)1691 remove_dir(old_root_dir)
16921692
1693 # fix broken symlink (md_version 4)1693 # fix broken symlink (md_version 4)
1694 self._upgrade_metadata_4(md_version)1694 self._upgrade_metadata_4(md_version)
@@ -1702,7 +1702,7 @@
1702 # the symnlink points to itself1702 # the symnlink points to itself
1703 self.log.debug('removing broken shares symlink: %r -> %r',1703 self.log.debug('removing broken shares symlink: %r -> %r',
1704 self._shares_dir_link, target)1704 self._shares_dir_link, target)
1705 os.remove(self._shares_dir_link)1705 remove_file(self._shares_dir_link)
1706 self._upgrade_metadata_5(md_version)1706 self._upgrade_metadata_5(md_version)
17071707
1708 def _upgrade_metadata_5(self, md_version):1708 def _upgrade_metadata_5(self, md_version):

Subscribers

People subscribed via source and target branches