mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-06-22 08:50:07 +00:00
Fix an import.
This commit is contained in:
@ -112,3 +112,26 @@ def skip_if_cannot_represent_filename(u):
|
|||||||
except UnicodeEncodeError:
|
except UnicodeEncodeError:
|
||||||
raise unittest.SkipTest("A non-ASCII filename could not be encoded on this platform.")
|
raise unittest.SkipTest("A non-ASCII filename could not be encoded on this platform.")
|
||||||
|
|
||||||
|
|
||||||
|
class Marker(object):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class FakeCanary(object):
|
||||||
|
"""For use in storage tests.
|
||||||
|
|
||||||
|
Can be moved back to test_storage.py once enough Python 3 porting has been
|
||||||
|
done.
|
||||||
|
"""
|
||||||
|
def __init__(self, ignore_disconnectors=False):
|
||||||
|
self.ignore = ignore_disconnectors
|
||||||
|
self.disconnectors = {}
|
||||||
|
def notifyOnDisconnect(self, f, *args, **kwargs):
|
||||||
|
if self.ignore:
|
||||||
|
return
|
||||||
|
m = Marker()
|
||||||
|
self.disconnectors[m] = (f, args, kwargs)
|
||||||
|
return m
|
||||||
|
def dontNotifyOnDisconnect(self, marker):
|
||||||
|
if self.ignore:
|
||||||
|
return
|
||||||
|
del self.disconnectors[marker]
|
||||||
|
@ -11,7 +11,7 @@ from allmydata.util import fileutil, hashutil, pollmixin
|
|||||||
from allmydata.storage.server import StorageServer, si_b2a
|
from allmydata.storage.server import StorageServer, si_b2a
|
||||||
from allmydata.storage.crawler import ShareCrawler, TimeSliceExceeded
|
from allmydata.storage.crawler import ShareCrawler, TimeSliceExceeded
|
||||||
|
|
||||||
from allmydata.test.test_storage import FakeCanary
|
from allmydata.test.common_py3 import FakeCanary
|
||||||
from allmydata.test.common_util import StallMixin
|
from allmydata.test.common_util import StallMixin
|
||||||
|
|
||||||
class BucketEnumeratingCrawler(ShareCrawler):
|
class BucketEnumeratingCrawler(ShareCrawler):
|
||||||
|
@ -35,24 +35,8 @@ from allmydata.test.no_network import NoNetworkServer
|
|||||||
from allmydata.storage_client import (
|
from allmydata.storage_client import (
|
||||||
_StorageServer,
|
_StorageServer,
|
||||||
)
|
)
|
||||||
|
from .common_py3 import FakeCanary
|
||||||
|
|
||||||
class Marker(object):
|
|
||||||
pass
|
|
||||||
|
|
||||||
class FakeCanary(object):
|
|
||||||
def __init__(self, ignore_disconnectors=False):
|
|
||||||
self.ignore = ignore_disconnectors
|
|
||||||
self.disconnectors = {}
|
|
||||||
def notifyOnDisconnect(self, f, *args, **kwargs):
|
|
||||||
if self.ignore:
|
|
||||||
return
|
|
||||||
m = Marker()
|
|
||||||
self.disconnectors[m] = (f, args, kwargs)
|
|
||||||
return m
|
|
||||||
def dontNotifyOnDisconnect(self, marker):
|
|
||||||
if self.ignore:
|
|
||||||
return
|
|
||||||
del self.disconnectors[marker]
|
|
||||||
|
|
||||||
class FakeStatsProvider(object):
|
class FakeStatsProvider(object):
|
||||||
def count(self, name, delta=1):
|
def count(self, name, delta=1):
|
||||||
|
Reference in New Issue
Block a user