diff --git a/.codecov.yml b/.codecov.yml index df1eb5e01..166190c5e 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -40,3 +40,9 @@ codecov: # repositories have coverage uploaded to the right place in codecov so # their reports aren't incomplete. token: "abf679b6-e2e6-4b33-b7b5-6cfbd41ee691" + + notify: + # The reference documentation suggests that this is the default setting: + # https://docs.codecov.io/docs/codecovyml-reference#codecovnotifywait_for_ci + # However observation suggests otherwise. + wait_for_ci: true diff --git a/newsfragments/3567.minor b/newsfragments/3567.minor new file mode 100644 index 000000000..e69de29bb diff --git a/newsfragments/3568.minor b/newsfragments/3568.minor new file mode 100644 index 000000000..e69de29bb diff --git a/src/allmydata/test/common_util.py b/src/allmydata/test/common_util.py index 168714492..16e744902 100644 --- a/src/allmydata/test/common_util.py +++ b/src/allmydata/test/common_util.py @@ -57,10 +57,10 @@ def run_cli_native(verb, *args, **kwargs): Most code should prefer ``run_cli_unicode`` which deals with all the necessary encoding considerations. - :param native_str verb: The command to run. For example, ``b"create-node"``. + :param native_str verb: The command to run. For example, ``"create-node"``. :param [native_str] args: The arguments to pass to the command. For example, - ``(b"--hostname=localhost",)``. + ``("--hostname=localhost",)``. :param [native_str] nodeargs: Extra arguments to pass to the Tahoe executable before ``verb``. diff --git a/src/allmydata/test/test_storage_client.py b/src/allmydata/test/test_storage_client.py index 18caccc5d..3a21dfd9e 100644 --- a/src/allmydata/test/test_storage_client.py +++ b/src/allmydata/test/test_storage_client.py @@ -457,7 +457,8 @@ class StoragePluginWebPresence(AsyncTestCase): self.storage_plugin = u"tahoe-lafs-dummy-v1" from twisted.internet import reactor - _, port_endpoint = self.port_assigner.assign(reactor) + _, webport_endpoint = self.port_assigner.assign(reactor) + tubport_location, tubport_endpoint = self.port_assigner.assign(reactor) tempdir = TempDir() self.useFixture(tempdir) @@ -468,8 +469,12 @@ class StoragePluginWebPresence(AsyncTestCase): "web": "1", }, node_config={ - "tub.location": "127.0.0.1:1", - "web.port": ensure_text(port_endpoint), + # We don't really need the main Tub listening but if we + # disable it then we also have to disable storage (because + # config validation policy). + "tub.port": tubport_endpoint, + "tub.location": tubport_location, + "web.port": ensure_text(webport_endpoint), }, storage_plugin=self.storage_plugin, basedir=self.basedir, diff --git a/src/allmydata/test/test_system.py b/src/allmydata/test/test_system.py index 192b82e78..e8b27fa69 100644 --- a/src/allmydata/test/test_system.py +++ b/src/allmydata/test/test_system.py @@ -70,7 +70,13 @@ from ..scripts.common import ( def run_cli(*args, **kwargs): """ - Backwards compatible version so we don't have to change all the tests. + Run a Tahoe-LAFS CLI utility, but inline. + + Version of run_cli_unicode() that takes any kind of string, and the + command-line args inline instead of as verb + list. + + Backwards compatible version so we don't have to change all the tests that + expected this API. """ nodeargs = [ensure_text(a) for a in kwargs.pop("nodeargs", [])] kwargs["nodeargs"] = nodeargs @@ -658,7 +664,7 @@ def flush_but_dont_ignore(res): def _render_config(config): """ - Convert a ``dict`` of ``dict`` of ``bytes`` to an ini-format string. + Convert a ``dict`` of ``dict`` of ``unicode`` to an ini-format string. """ return u"\n\n".join(list( _render_config_section(k, v) @@ -668,8 +674,8 @@ def _render_config(config): def _render_config_section(heading, values): """ - Convert a ``bytes`` heading and a ``dict`` of ``bytes`` to an ini-format - section as ``bytes``. + Convert a ``unicode`` heading and a ``dict`` of ``unicode`` to an ini-format + section as ``unicode``. """ return u"[{}]\n{}\n".format( heading, _render_section_values(values) @@ -677,8 +683,8 @@ def _render_config_section(heading, values): def _render_section_values(values): """ - Convert a ``dict`` of ``bytes`` to the body of an ini-format section as - ``bytes``. + Convert a ``dict`` of ``unicode`` to the body of an ini-format section as + ``unicode``. """ return u"\n".join(list( u"{} = {}".format(k, v) diff --git a/src/allmydata/util/base32.py b/src/allmydata/util/base32.py index 75625c817..efad58841 100644 --- a/src/allmydata/util/base32.py +++ b/src/allmydata/util/base32.py @@ -134,8 +134,7 @@ def a2b(cs): @param cs the base-32 encoded data (as bytes) """ # Workaround Future newbytes issues by converting to real bytes on Python 2: - if hasattr(cs, "__native__"): - cs = cs.__native__() + cs = backwardscompat_bytes(cs) precondition(could_be_base32_encoded(cs), "cs is required to be possibly base32 encoded data.", cs=cs) precondition(isinstance(cs, bytes), cs) diff --git a/src/allmydata/web/common.py b/src/allmydata/web/common.py index 98f915a1e..2832cc6a8 100644 --- a/src/allmydata/web/common.py +++ b/src/allmydata/web/common.py @@ -211,7 +211,15 @@ def compute_rate(bytes, seconds): return 1.0 * bytes / seconds def abbreviate_rate(data): - # 21.8kBps, 554.4kBps 4.37MBps + """ + Convert number of bytes/second into human readable strings (unicode). + + Uses metric measures, so 1000 not 1024, e.g. 21.8kBps, 554.4kBps, 4.37MBps. + + :param data: Either ``None`` or integer. + + :return: Unicode string. + """ if data is None: return u"" r = float(data) @@ -222,7 +230,15 @@ def abbreviate_rate(data): return u"%.0fBps" % r def abbreviate_size(data): - # 21.8kB, 554.4kB 4.37MB + """ + Convert number of bytes into human readable strings (unicode). + + Uses metric measures, so 1000 not 1024, e.g. 21.8kB, 554.4kB, 4.37MB. + + :param data: Either ``None`` or integer. + + :return: Unicode string. + """ if data is None: return u"" r = float(data) diff --git a/src/allmydata/web/common_py3.py b/src/allmydata/web/common_py3.py index 9d4435706..b91f53a3a 100644 --- a/src/allmydata/web/common_py3.py +++ b/src/allmydata/web/common_py3.py @@ -105,6 +105,13 @@ class MultiFormatResource(resource.Resource, object): def abbreviate_time(data): + """ + Convert number of seconds into human readable string. + + :param data: Either ``None`` or integer or float, seconds. + + :return: Unicode string. + """ # 1.23s, 790ms, 132us if data is None: return u""