diff --git a/src/allmydata/test/common_util.py b/src/allmydata/test/common_util.py index 1ad0f8242..63c39d39a 100644 --- a/src/allmydata/test/common_util.py +++ b/src/allmydata/test/common_util.py @@ -59,10 +59,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_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)