reduce fragility of tests .. maybe?
only trivially, at best, of course.
This commit is contained in:
parent
e1c469e3b6
commit
035dc6dc76
|
@ -401,11 +401,18 @@ class Basic(testutil.ReallyEqualMixin, testutil.NonASCIIPathMixin, unittest.Test
|
||||||
_check("helper.furl = pb://blah\n", "pb://blah")
|
_check("helper.furl = pb://blah\n", "pb://blah")
|
||||||
|
|
||||||
def test_create_magic_folder_service(self):
|
def test_create_magic_folder_service(self):
|
||||||
class MockMagicFolder(service.MultiService):
|
boom = False
|
||||||
|
class Boom(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class MockMagicFolder(allmydata.frontends.magic_folder.MagicFolder):
|
||||||
name = 'magic-folder'
|
name = 'magic-folder'
|
||||||
|
|
||||||
def __init__(self, client, upload_dircap, collective_dircap, local_path_u, dbfile, umask, name,
|
def __init__(self, client, upload_dircap, collective_dircap, local_path_u, dbfile, umask, name,
|
||||||
inotify=None, uploader_delay=1.0, clock=None, downloader_delay=3):
|
inotify=None, uploader_delay=1.0, clock=None, downloader_delay=3):
|
||||||
|
if boom:
|
||||||
|
raise Boom()
|
||||||
|
|
||||||
service.MultiService.__init__(self)
|
service.MultiService.__init__(self)
|
||||||
self.client = client
|
self.client = client
|
||||||
self._umask = umask
|
self._umask = umask
|
||||||
|
@ -415,6 +422,12 @@ class Basic(testutil.ReallyEqualMixin, testutil.NonASCIIPathMixin, unittest.Test
|
||||||
self.dbfile = dbfile
|
self.dbfile = dbfile
|
||||||
self.inotify = inotify
|
self.inotify = inotify
|
||||||
|
|
||||||
|
def startService(self):
|
||||||
|
self.running = True
|
||||||
|
|
||||||
|
def stopService(self):
|
||||||
|
self.running = False
|
||||||
|
|
||||||
def ready(self):
|
def ready(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -461,12 +474,8 @@ class Basic(testutil.ReallyEqualMixin, testutil.NonASCIIPathMixin, unittest.Test
|
||||||
self.failUnless(magicfolder.inotify is None, magicfolder.inotify)
|
self.failUnless(magicfolder.inotify is None, magicfolder.inotify)
|
||||||
self.failUnless(magicfolder.running)
|
self.failUnless(magicfolder.running)
|
||||||
|
|
||||||
class Boom(Exception):
|
# See above.
|
||||||
pass
|
boom = True
|
||||||
def BoomMagicFolder(client, upload_dircap, collective_dircap, local_path_u, dbfile, name,
|
|
||||||
umask, inotify=None, uploader_delay=1.0, clock=None, downloader_delay=3):
|
|
||||||
raise Boom()
|
|
||||||
self.patch(allmydata.frontends.magic_folder, 'MagicFolder', BoomMagicFolder)
|
|
||||||
|
|
||||||
basedir2 = "test_client.Basic.test_create_magic_folder_service2"
|
basedir2 = "test_client.Basic.test_create_magic_folder_service2"
|
||||||
os.mkdir(basedir2)
|
os.mkdir(basedir2)
|
||||||
|
|
Loading…
Reference in New Issue