Changeset 17f0676 in trunk
- Timestamp:
- 2020-10-09T14:22:17Z (5 years ago)
- Branches:
- master
- Children:
- 3ea18ca
- Parents:
- c680b1d (diff), cc8c9c0 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - git-author:
- Itamar Turner-Trauring <itamar@…> (2020-10-09 14:22:17)
- git-committer:
- GitHub <noreply@…> (2020-10-09 14:22:17)
- Files:
-
- 7 added
- 1 deleted
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified Makefile ¶
rc680b1d r17f0676 52 52 test-venv-coverage: 53 53 # Special handling for reporting coverage even when the test run fails 54 rm -f ./.coverage.* 54 55 test_exit= 55 56 $(VIRTUAL_ENV)/bin/coverage run -m twisted.trial --rterrors --reporter=timing \ -
TabularUnified misc/python3/Makefile ¶
rc680b1d r17f0676 1 # BBB:Python 3 porting targets1 # Python 3 porting targets 2 2 # 3 3 # NOTE: this Makefile requires GNU make -
TabularUnified src/allmydata/__init__.py ¶
rc680b1d r17f0676 43 43 from future import standard_library 44 44 standard_library.install_aliases() 45 46 47 # Monkey-patch 3rd party libraries: 48 from ._monkeypatch import patch 49 patch() 50 del patch -
TabularUnified src/allmydata/client.py ¶
rc680b1d r17f0676 70 70 """ 71 71 return ( 72 section_name.startswith( b"storageserver.plugins.") or73 section_name.startswith( b"storageclient.plugins.")72 section_name.startswith("storageserver.plugins.") or 73 section_name.startswith("storageclient.plugins.") 74 74 ) 75 75 -
TabularUnified src/allmydata/immutable/downloader/share.py ¶
rc680b1d r17f0676 7 7 from __future__ import unicode_literals 8 8 9 from future.utils import PY2 , native_str9 from future.utils import PY2 10 10 if PY2: 11 11 from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401 … … 766 766 767 767 def _send_request(self, start, length): 768 # For some reason tests fail on Python 2 if this is not a native 769 # string... 770 return self._rref.callRemote(native_str("read"), start, length) 768 return self._rref.callRemote("read", start, length) 771 769 772 770 def _got_data(self, data, start, length, block_ev, lp): -
TabularUnified src/allmydata/immutable/encode.py ¶
rc680b1d r17f0676 1 1 # -*- test-case-name: allmydata.test.test_encode -*- 2 3 """ 4 Ported to Python 3. 5 """ 6 7 from __future__ import division 8 from __future__ import absolute_import 9 from __future__ import print_function 10 from __future__ import unicode_literals 11 12 from future.utils import PY2 13 if PY2: 14 from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401 2 15 3 16 import time … … 469 482 self.segment_size*(segnum+1), 470 483 self.segment_size*self.num_segments, 471 100 * (segnum+1) / self.num_segments,484 100 * (segnum+1) // self.num_segments, 472 485 ), 473 486 level=log.OPERATIONAL) -
TabularUnified src/allmydata/immutable/filenode.py ¶
rc680b1d r17f0676 1 """ 2 Ported to Python 3. 3 """ 4 5 from __future__ import absolute_import 6 from __future__ import division 7 from __future__ import print_function 8 from __future__ import unicode_literals 9 10 from future.utils import PY2 11 if PY2: 12 from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401 13 1 14 from functools import reduce 2 15 import binascii -
TabularUnified src/allmydata/immutable/layout.py ¶
rc680b1d r17f0676 1 """ 2 Ported to Python 3. 3 """ 4 from __future__ import absolute_import 5 from __future__ import division 6 from __future__ import print_function 7 from __future__ import unicode_literals 8 9 from future.utils import PY2 10 if PY2: 11 from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401 12 1 13 import struct 2 14 from zope.interface import implementer -
TabularUnified src/allmydata/immutable/upload.py ¶
rc680b1d r17f0676 1 """ 2 Ported to Python 3. 3 """ 4 5 from __future__ import absolute_import 6 from __future__ import division 7 from __future__ import print_function 8 from __future__ import unicode_literals 9 10 from future.utils import PY2, native_str 11 if PY2: 12 from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401 1 13 from past.builtins import long, unicode 2 14 … … 67 79 server: list(shares) 68 80 for (server, shares) 69 in existing_shares.ite ritems()81 in existing_shares.items() 70 82 } 71 83 … … 80 92 sharenum: base32.b2a(serverid) 81 93 for (sharenum, serverid) 82 in happiness_mappings.ite ritems()94 in happiness_mappings.items() 83 95 } 84 96 … … 151 163 # helper, and it does *not* need to match the fully-qualified 152 164 # package/module/class name 153 typeToCopy = "allmydata.upload.UploadResults.tahoe.allmydata.com" 165 # 166 # Needs to be native string to make Foolscap happy. 167 typeToCopy = native_str("allmydata.upload.UploadResults.tahoe.allmydata.com") 154 168 copytype = typeToCopy 155 169 … … 284 298 (alreadygot, buckets) = alreadygot_and_buckets 285 299 b = {} 286 for sharenum, rref in buckets.items():300 for sharenum, rref in list(buckets.items()): 287 301 bp = self.wbp_class(rref, self._server, self.sharesize, 288 302 self.blocksize, … … 781 795 shares_to_ask = set() 782 796 servermap = self._share_placements 783 for shnum, tracker_id in servermap.items():797 for shnum, tracker_id in list(servermap.items()): 784 798 if tracker_id == None: 785 799 continue … … 1575 1589 1576 1590 sharemap = upload_results.sharemap 1577 if str in [type(v) for v in sharemap.values()]:1591 if any(isinstance(v, (bytes, unicode)) for v in sharemap.values()): 1578 1592 upload_results.sharemap = None 1579 1593 -
TabularUnified src/allmydata/node.py ¶
rc680b1d r17f0676 10 10 import types 11 11 import errno 12 from io import StringIO 13 import tempfile 14 from base64 import b32decode, b32encode 15 16 # Python 2 compatibility 12 17 from six.moves import configparser 13 import tempfile 14 from io import BytesIO 15 from base64 import b32decode, b32encode 18 from future.utils import PY2 19 if PY2: 20 from io import BytesIO as StringIO # noqa: F811 16 21 17 22 from twisted.python import log as twlog … … 71 76 # reports. 72 77 for thing, things_version in get_package_versions().items(): 73 app_versions.add_version(thing, str(things_version))78 app_versions.add_version(thing, things_version) 74 79 75 80 # group 1 will be addr (dotted quad string), group 3 if any will be portnum (string) … … 207 212 # load configuration from in-memory string 208 213 parser = configparser.SafeConfigParser() 209 parser.readfp( BytesIO(config_str))214 parser.readfp(StringIO(config_str)) 210 215 211 216 fname = "<in-memory>" … … 822 827 # o might be a FileLogObserver's .emit method 823 828 if type(o) is type(self.setup_logging): # bound method 824 ob = o. im_self829 ob = o.__self__ 825 830 if isinstance(ob, twlog.FileLogObserver): 826 newmeth = types. UnboundMethodType(formatTimeTahoeStyle, ob, ob.__class__)831 newmeth = types.MethodType(formatTimeTahoeStyle, ob) 827 832 ob.formatTime = newmeth 828 833 # TODO: twisted >2.5.0 offers maxRotatedFiles=50 -
TabularUnified src/allmydata/scripts/common.py ¶
rc680b1d r17f0676 5 5 from os.path import join 6 6 7 # BBB:Python 2 compatibility7 # Python 2 compatibility 8 8 from future.utils import PY2 9 9 if PY2: -
TabularUnified src/allmydata/scripts/stats_gatherer.py ¶
rc680b1d r17f0676 3 3 import os 4 4 5 # BBB:Python 2 compatibility5 # Python 2 compatibility 6 6 from future.utils import PY2 7 7 if PY2: -
TabularUnified src/allmydata/scripts/tahoe_check.py ¶
rc680b1d r17f0676 4 4 import json 5 5 6 # BBB:Python 2 compatibility6 # Python 2 compatibility 7 7 from future.utils import PY2 8 8 if PY2: -
TabularUnified src/allmydata/stats.py ¶
rc680b1d r17f0676 7 7 from collections import deque 8 8 9 # BBB:Python 2 compatibility9 # Python 2 compatibility 10 10 from future.utils import PY2 11 11 if PY2: -
TabularUnified src/allmydata/test/check_load.py ¶
rc680b1d r17f0676 38 38 import urllib, json, random, time, urlparse 39 39 40 # BBB:Python 2 compatibility40 # Python 2 compatibility 41 41 from future.utils import PY2 42 42 if PY2: -
TabularUnified src/allmydata/test/check_memory.py ¶
rc680b1d r17f0676 3 3 import os, shutil, sys, urllib, time, stat, urlparse 4 4 5 # BBB:Python 2 compatibility5 # Python 2 compatibility 6 6 from future.utils import PY2 7 7 if PY2: -
TabularUnified src/allmydata/test/common.py ¶
rc680b1d r17f0676 47 47 ) 48 48 49 from twisted.application import service 49 50 from twisted.plugin import IPlugin 50 51 from twisted.internet import defer … … 88 89 EliotLoggedRunTest, 89 90 ) 90 # Backwards compatibility imports: 91 from .common_py3 import LoggingServiceParent, ShouldFailMixin # noqa: F401 91 from .common_util import ShouldFailMixin # noqa: F401 92 92 93 93 … … 95 95 96 96 EMPTY_CLIENT_CONFIG = config_from_string( 97 b"/dev/null",98 b"tub.port",99 b""97 "/dev/null", 98 "tub.port", 99 "" 100 100 ) 101 101 … … 250 250 self.config = config_from_string( 251 251 self.basedir.asTextMode().path, 252 u"tub.port",253 b"""252 "tub.port", 253 """ 254 254 [node] 255 255 {node_config} … … 782 782 783 783 784 class LoggingServiceParent(service.MultiService): 785 def log(self, *args, **kwargs): 786 return log.msg(*args, **kwargs) 787 788 784 789 TEST_DATA=b"\x02"*(Uploader.URI_LIT_SIZE_THRESHOLD+1) 785 790 -
TabularUnified src/allmydata/test/common_util.py ¶
rc680b1d r17f0676 2 2 3 3 import os 4 import time 5 import signal 4 6 from random import randrange 5 7 from six.moves import StringIO 6 8 7 9 from twisted.internet import reactor, defer 10 from twisted.python import failure 8 11 from twisted.trial import unittest 9 12 10 13 from ..util.assertutil import precondition 11 14 from ..scripts import runner 12 from allmydata.util.encodingutil import get_io_encoding15 from allmydata.util.encodingutil import unicode_platform, get_filesystem_encoding, get_io_encoding 13 16 # Imported for backwards compatibility: 14 17 from future.utils import bord, bchr, binary_type 15 from .common_py3 import ( 16 SignalMixin, skip_if_cannot_represent_filename, ReallyEqualMixin, ShouldFailMixin 17 ) 18 18 from past.builtins import unicode 19 20 21 def skip_if_cannot_represent_filename(u): 22 precondition(isinstance(u, unicode)) 23 24 enc = get_filesystem_encoding() 25 if not unicode_platform(): 26 try: 27 u.encode(enc) 28 except UnicodeEncodeError: 29 raise unittest.SkipTest("A non-ASCII filename could not be encoded on this platform.") 19 30 20 31 def skip_if_cannot_represent_argv(u): … … 79 90 80 91 92 class ReallyEqualMixin(object): 93 def failUnlessReallyEqual(self, a, b, msg=None): 94 self.assertEqual(a, b, msg) 95 self.assertEqual(type(a), type(b), "a :: %r (%s), b :: %r (%s), %r" % (a, type(a), b, type(b), msg)) 96 97 98 class SignalMixin(object): 99 # This class is necessary for any code which wants to use Processes 100 # outside the usual reactor.run() environment. It is copied from 101 # Twisted's twisted.test.test_process . Note that Twisted-8.2.0 uses 102 # something rather different. 103 sigchldHandler = None 104 105 def setUp(self): 106 # make sure SIGCHLD handler is installed, as it should be on 107 # reactor.run(). problem is reactor may not have been run when this 108 # test runs. 109 if hasattr(reactor, "_handleSigchld") and hasattr(signal, "SIGCHLD"): 110 self.sigchldHandler = signal.signal(signal.SIGCHLD, 111 reactor._handleSigchld) 112 return super(SignalMixin, self).setUp() 113 114 def tearDown(self): 115 if self.sigchldHandler: 116 signal.signal(signal.SIGCHLD, self.sigchldHandler) 117 return super(SignalMixin, self).tearDown() 118 119 81 120 class StallMixin(object): 82 121 def stall(self, res=None, delay=1): 83 122 d = defer.Deferred() 84 123 reactor.callLater(delay, d.callback, res) 124 return d 125 126 127 class Marker(object): 128 pass 129 130 class FakeCanary(object): 131 """For use in storage tests. 132 """ 133 def __init__(self, ignore_disconnectors=False): 134 self.ignore = ignore_disconnectors 135 self.disconnectors = {} 136 def notifyOnDisconnect(self, f, *args, **kwargs): 137 if self.ignore: 138 return 139 m = Marker() 140 self.disconnectors[m] = (f, args, kwargs) 141 return m 142 def dontNotifyOnDisconnect(self, marker): 143 if self.ignore: 144 return 145 del self.disconnectors[marker] 146 def getRemoteTubID(self): 147 return None 148 def getPeer(self): 149 return "<fake>" 150 151 152 class ShouldFailMixin(object): 153 154 def shouldFail(self, expected_failure, which, substring, 155 callable, *args, **kwargs): 156 """Assert that a function call raises some exception. This is a 157 Deferred-friendly version of TestCase.assertRaises() . 158 159 Suppose you want to verify the following function: 160 161 def broken(a, b, c): 162 if a < 0: 163 raise TypeError('a must not be negative') 164 return defer.succeed(b+c) 165 166 You can use: 167 d = self.shouldFail(TypeError, 'test name', 168 'a must not be negative', 169 broken, -4, 5, c=12) 170 in your test method. The 'test name' string will be included in the 171 error message, if any, because Deferred chains frequently make it 172 difficult to tell which assertion was tripped. 173 174 The substring= argument, if not None, must appear in the 'repr' 175 of the message wrapped by this Failure, or the test will fail. 176 """ 177 178 assert substring is None or isinstance(substring, (bytes, unicode)) 179 d = defer.maybeDeferred(callable, *args, **kwargs) 180 def done(res): 181 if isinstance(res, failure.Failure): 182 res.trap(expected_failure) 183 if substring: 184 self.failUnless(substring in str(res), 185 "%s: substring '%s' not in '%s'" 186 % (which, substring, str(res))) 187 # return the Failure for further analysis, but in a form that 188 # doesn't make the Deferred chain think that we failed. 189 return [res] 190 else: 191 self.fail("%s was supposed to raise %s, not get '%s'" % 192 (which, expected_failure, res)) 193 d.addBoth(done) 85 194 return d 86 195 … … 131 240 if required_to_quiesce and active: 132 241 self.fail("Reactor was still active when it was required to be quiescent.") 242 243 244 class TimezoneMixin(object): 245 246 def setTimezone(self, timezone): 247 def tzset_if_possible(): 248 # Windows doesn't have time.tzset(). 249 if hasattr(time, 'tzset'): 250 time.tzset() 251 252 unset = object() 253 originalTimezone = os.environ.get('TZ', unset) 254 def restoreTimezone(): 255 if originalTimezone is unset: 256 del os.environ['TZ'] 257 else: 258 os.environ['TZ'] = originalTimezone 259 tzset_if_possible() 260 261 os.environ['TZ'] = timezone 262 self.addCleanup(restoreTimezone) 263 tzset_if_possible() 264 265 def have_working_tzset(self): 266 return hasattr(time, 'tzset') 133 267 134 268 -
TabularUnified src/allmydata/test/eliotutil.py ¶
rc680b1d r17f0676 3 3 """ 4 4 5 # BBB:Python 2 compatibility5 # Python 2 compatibility 6 6 # Can't use `builtins.str` because it's not JSON encodable: 7 7 # `exceptions.TypeError: <class 'future.types.newstr.newstr'> is not JSON-encodeable` … … 107 107 # Begin an action that should comprise all messages from the decorated 108 108 # test method. 109 with RUN_TEST(name=self.id() .decode("utf-8")).context() as action:109 with RUN_TEST(name=self.id()).context() as action: 110 110 # When the test method Deferred fires, the RUN_TEST action is 111 111 # done. However, we won't have re-published the MemoryLogger -
TabularUnified src/allmydata/test/mutable/test_version.py ¶
rc680b1d r17f0676 3 3 import os 4 4 5 # BBB:Python 2 compatibility5 # Python 2 compatibility 6 6 from future.utils import PY2 7 7 if PY2: -
TabularUnified src/allmydata/test/test_auth.py ¶
rc680b1d r17f0676 1 # BBB:Python 2 compatibility1 # Python 2 compatibility 2 2 from future.utils import PY2 3 3 if PY2: -
TabularUnified src/allmydata/test/test_client.py ¶
rc680b1d r17f0676 253 253 """ 254 254 config = client.config_from_string( 255 b"test_storage_default_anonymous_enabled",256 b"tub.port",255 "test_storage_default_anonymous_enabled", 256 "tub.port", 257 257 BASECONFIG + ( 258 b"[storage]\n"259 b"enabled = true\n"258 "[storage]\n" 259 "enabled = true\n" 260 260 ) 261 261 ) … … 269 269 config = client.config_from_string( 270 270 self.id(), 271 b"tub.port",271 "tub.port", 272 272 BASECONFIG + ( 273 b"[storage]\n"274 b"enabled = true\n"275 b"anonymous = true\n"273 "[storage]\n" 274 "enabled = true\n" 275 "anonymous = true\n" 276 276 ) 277 277 ) … … 285 285 config = client.config_from_string( 286 286 self.id(), 287 b"tub.port",287 "tub.port", 288 288 BASECONFIG + ( 289 b"[storage]\n"290 b"enabled = true\n"291 b"anonymous = false\n"289 "[storage]\n" 290 "enabled = true\n" 291 "anonymous = false\n" 292 292 ) 293 293 ) … … 301 301 config = client.config_from_string( 302 302 self.id(), 303 b"tub.port",303 "tub.port", 304 304 BASECONFIG + ( 305 b"[storage]\n"306 b"enabled = false\n"307 b"anonymous = true\n"305 "[storage]\n" 306 "enabled = false\n" 307 "anonymous = true\n" 308 308 ) 309 309 ) … … 681 681 config = client.config_from_string( 682 682 basedir, 683 b"tub.port",683 "tub.port", 684 684 BASECONFIG_I % (SOME_FURL,) + ( 685 b"[storage]\n"686 b"enabled = true\n"687 b"anonymous = true\n"685 "[storage]\n" 686 "enabled = true\n" 687 "anonymous = true\n" 688 688 ) 689 689 ) … … 712 712 config = client.config_from_string( 713 713 basedir, 714 b"tub.port",714 "tub.port", 715 715 BASECONFIG_I % (SOME_FURL,) + ( 716 b"[storage]\n"717 b"enabled = true\n"718 b"anonymous = false\n"716 "[storage]\n" 717 "enabled = true\n" 718 "anonymous = false\n" 719 719 ) 720 720 ) … … 733 733 ) 734 734 self.expectThat( 735 config.get_private_config( b"storage.furl", default=None),735 config.get_private_config("storage.furl", default=None), 736 736 Is(None), 737 737 ) … … 749 749 enabled_config = client.config_from_string( 750 750 basedir, 751 b"tub.port",751 "tub.port", 752 752 BASECONFIG_I % (SOME_FURL,) + ( 753 b"[storage]\n"754 b"enabled = true\n"755 b"anonymous = true\n"753 "[storage]\n" 754 "enabled = true\n" 755 "anonymous = true\n" 756 756 ) 757 757 ) … … 760 760 _introducer_factory=MemoryIntroducerClient, 761 761 ) 762 anonymous_storage_furl = enabled_config.get_private_config( b"storage.furl")762 anonymous_storage_furl = enabled_config.get_private_config("storage.furl") 763 763 def check_furl(): 764 764 return node.tub.getReferenceForURL(anonymous_storage_furl) … … 773 773 disabled_config = client.config_from_string( 774 774 basedir, 775 b"tub.port",775 "tub.port", 776 776 BASECONFIG_I % (SOME_FURL,) + ( 777 b"[storage]\n"778 b"enabled = true\n"779 b"anonymous = false\n"777 "[storage]\n" 778 "enabled = true\n" 779 "anonymous = false\n" 780 780 ) 781 781 ) … … 1138 1138 1139 1139 1140 def get_config(self, storage_enabled, more_storage= b"", more_sections=b""):1141 return b"""1140 def get_config(self, storage_enabled, more_storage="", more_sections=""): 1141 return """ 1142 1142 [node] 1143 1143 tub.location = tcp:192.0.2.0:1234 … … 1164 1164 config = client.config_from_string( 1165 1165 self.basedir, 1166 u"tub.port",1166 "tub.port", 1167 1167 self.get_config(storage_enabled=False), 1168 1168 ) … … 1186 1186 config = client.config_from_string( 1187 1187 self.basedir, 1188 u"tub.port",1188 "tub.port", 1189 1189 self.get_config(storage_enabled=True), 1190 1190 ) … … 1218 1218 config = client.config_from_string( 1219 1219 self.basedir, 1220 u"tub.port",1220 "tub.port", 1221 1221 self.get_config( 1222 1222 storage_enabled=True, 1223 more_storage= b"plugins=tahoe-lafs-dummy-v1",1223 more_storage="plugins=tahoe-lafs-dummy-v1", 1224 1224 more_sections=( 1225 b"[storageserver.plugins.tahoe-lafs-dummy-v1]\n"1226 b"some = {}\n".format(value)1225 "[storageserver.plugins.tahoe-lafs-dummy-v1]\n" 1226 "some = {}\n".format(value) 1227 1227 ), 1228 1228 ), … … 1259 1259 config = client.config_from_string( 1260 1260 self.basedir, 1261 u"tub.port",1261 "tub.port", 1262 1262 self.get_config( 1263 1263 storage_enabled=True, 1264 more_storage= b"plugins=tahoe-lafs-dummy-v1,tahoe-lafs-dummy-v2",1264 more_storage="plugins=tahoe-lafs-dummy-v1,tahoe-lafs-dummy-v2", 1265 1265 more_sections=( 1266 b"[storageserver.plugins.tahoe-lafs-dummy-v1]\n"1267 b"some = thing-1\n"1268 b"[storageserver.plugins.tahoe-lafs-dummy-v2]\n"1269 b"some = thing-2\n"1266 "[storageserver.plugins.tahoe-lafs-dummy-v1]\n" 1267 "some = thing-1\n" 1268 "[storageserver.plugins.tahoe-lafs-dummy-v2]\n" 1269 "some = thing-2\n" 1270 1270 ), 1271 1271 ), … … 1307 1307 config = client.config_from_string( 1308 1308 self.basedir, 1309 u"tub.port",1309 "tub.port", 1310 1310 self.get_config( 1311 1311 storage_enabled=True, 1312 more_storage= b"plugins=tahoe-lafs-dummy-v1",1312 more_storage="plugins=tahoe-lafs-dummy-v1", 1313 1313 more_sections=( 1314 b"[storageserver.plugins.tahoe-lafs-dummy-v1]\n"1315 b"some = thing\n"1314 "[storageserver.plugins.tahoe-lafs-dummy-v1]\n" 1315 "some = thing\n" 1316 1316 ), 1317 1317 ), … … 1343 1343 config = client.config_from_string( 1344 1344 self.basedir, 1345 u"tub.port",1345 "tub.port", 1346 1346 self.get_config( 1347 1347 storage_enabled=True, 1348 more_storage= b"plugins=tahoe-lafs-dummy-v1",1348 more_storage="plugins=tahoe-lafs-dummy-v1", 1349 1349 ), 1350 1350 ) … … 1381 1381 config = client.config_from_string( 1382 1382 self.basedir, 1383 u"tub.port",1383 "tub.port", 1384 1384 self.get_config( 1385 1385 storage_enabled=True, 1386 more_storage= b"plugins=tahoe-lafs-dummy-v1",1386 more_storage="plugins=tahoe-lafs-dummy-v1", 1387 1387 more_sections=( 1388 b"[storageserver.plugins.tahoe-lafs-dummy-v1]\n"1388 "[storageserver.plugins.tahoe-lafs-dummy-v1]\n" 1389 1389 # This will make it explode on instantiation. 1390 b"invalid = configuration\n"1390 "invalid = configuration\n" 1391 1391 ) 1392 1392 ), … … 1408 1408 config = client.config_from_string( 1409 1409 self.basedir, 1410 u"tub.port",1410 "tub.port", 1411 1411 self.get_config( 1412 1412 storage_enabled=True, 1413 more_storage= b"plugins=tahoe-lafs-dummy-vX",1413 more_storage="plugins=tahoe-lafs-dummy-vX", 1414 1414 ), 1415 1415 ) -
TabularUnified src/allmydata/test/test_crawler.py ¶
rc680b1d r17f0676 28 28 from allmydata.storage.crawler import ShareCrawler, TimeSliceExceeded 29 29 30 from allmydata.test.common_py3 import FakeCanary 31 from allmydata.test.common_util import StallMixin 30 from allmydata.test.common_util import StallMixin, FakeCanary 32 31 33 32 class BucketEnumeratingCrawler(ShareCrawler): -
TabularUnified src/allmydata/test/test_deepcheck.py ¶
rc680b1d r17f0676 1 1 import os, json, urllib 2 2 3 # BBB:Python 2 compatibility3 # Python 2 compatibility 4 4 # Can't use `builtins.str` because something deep in Twisted callbacks ends up repr'ing 5 5 # a `future.types.newstr.newstr` as a *Python 3* byte string representation under -
TabularUnified src/allmydata/test/test_encodingutil.py ¶
rc680b1d r17f0676 78 78 from twisted.python.filepath import FilePath 79 79 80 from allmydata.test.common_ py3import (80 from allmydata.test.common_util import ( 81 81 ReallyEqualMixin, skip_if_cannot_represent_filename, 82 82 ) -
TabularUnified src/allmydata/test/test_happiness.py ¶
rc680b1d r17f0676 24 24 from allmydata.util.happinessutil import servers_of_happiness, \ 25 25 shares_by_server, merge_servers 26 from allmydata.test.common _py3import ShouldFailMixin26 from allmydata.test.common import ShouldFailMixin 27 27 28 28 -
TabularUnified src/allmydata/test/test_iputil.py ¶
rc680b1d r17f0676 24 24 25 25 from allmydata.util import iputil, gcutil 26 import allmydata.test.common_ py3as testutil26 import allmydata.test.common_util as testutil 27 27 from allmydata.util.namespace import Namespace 28 28 -
TabularUnified src/allmydata/test/test_node.py ¶
rc680b1d r17f0676 521 521 [i2p] 522 522 enabled = false 523 [node]524 523 """ 525 524 … … 567 566 with open(os.path.join(basedir, "tahoe.cfg"), "w") as f: 568 567 f.write(BASE_CONFIG) 568 f.write("[node]\n") 569 569 f.write("tub.port = tcp:0\n") 570 570 f.write("tub.location = AUTO\n") … … 595 595 with open(os.path.join(basedir, "tahoe.cfg"), "w") as f: 596 596 f.write(BASE_CONFIG) 597 f.write("[node]\n") 597 598 f.write("tub.port = %s\n" % port) 598 599 f.write("tub.location = %s\n" % location) … … 618 619 with open(config_fname, "w") as f: 619 620 f.write(BASE_CONFIG) 621 f.write("[node]\n") 620 622 f.write("tub.port = listen:i2p,listen:tor\n") 621 623 f.write("tub.location = tcp:example.org:1234\n") -
TabularUnified src/allmydata/test/test_storage.py ¶
rc680b1d r17f0676 52 52 _StorageServer, 53 53 ) 54 from .common_py3 import FakeCanary, LoggingServiceParent, ShouldFailMixin 54 from .common import LoggingServiceParent, ShouldFailMixin 55 from .common_util import FakeCanary 55 56 56 57 -
TabularUnified src/allmydata/test/test_storage_web.py ¶
rc680b1d r17f0676 51 51 remove_prefix 52 52 ) 53 from .common_ py3import FakeCanary53 from .common_util import FakeCanary 54 54 55 55 def remove_tags(s): -
TabularUnified src/allmydata/test/test_time_format.py ¶
rc680b1d r17f0676 17 17 from twisted.trial import unittest 18 18 19 from allmydata.test.common_ py3import TimezoneMixin19 from allmydata.test.common_util import TimezoneMixin 20 20 from allmydata.util import time_format 21 21 -
TabularUnified src/allmydata/test/test_upload.py ¶
rc680b1d r17f0676 29 29 from allmydata.util.deferredutil import DeferredListShouldSucceed 30 30 from allmydata.test.no_network import GridTestMixin 31 from allmydata.test.common_py3 import ShouldFailMixin32 31 from allmydata.storage_client import StorageFarmBroker 33 32 from allmydata.storage.server import storage_index_to_dir … … 35 34 from .common import ( 36 35 EMPTY_CLIENT_CONFIG, 36 ShouldFailMixin, 37 37 ) 38 38 from functools import reduce -
TabularUnified src/allmydata/test/web/test_introducer.py ¶
rc680b1d r17f0676 34 34 SameProcessStreamEndpointAssigner, 35 35 ) 36 from ..common_ py3import (36 from ..common_util import ( 37 37 FakeCanary, 38 38 ) -
TabularUnified src/allmydata/test/web/test_web.py ¶
rc680b1d r17f0676 53 53 from allmydata.mutable import servermap, publish, retrieve 54 54 from .. import common_util as testutil 55 from ..common_ py3import TimezoneMixin55 from ..common_util import TimezoneMixin 56 56 from ..common_web import ( 57 57 do_http, -
TabularUnified src/allmydata/util/_python3.py ¶
rc680b1d r17f0676 25 25 # Keep these sorted alphabetically, to reduce merge conflicts: 26 26 PORTED_MODULES = [ 27 "allmydata._monkeypatch", 27 28 "allmydata.codec", 28 29 "allmydata.crypto", … … 41 42 "allmydata.immutable.downloader.share", 42 43 "allmydata.immutable.downloader.status", 44 "allmydata.immutable.encode", 45 "allmydata.immutable.filenode", 43 46 "allmydata.immutable.happiness_upload", 47 "allmydata.immutable.layout", 44 48 "allmydata.immutable.literal", 49 "allmydata.immutable.upload", 45 50 "allmydata.interfaces", 46 51 "allmydata.introducer.interfaces", … … 54 59 "allmydata.storage.server", 55 60 "allmydata.storage.shares", 56 "allmydata.test.common_py3",57 61 "allmydata.test.no_network", 58 62 "allmydata.uri",
Note: See TracChangeset
for help on using the changeset viewer.