From 9dcfa2171ef11e8e7ed111a6613840d52d965fb3 Mon Sep 17 00:00:00 2001 From: Itamar Turner-Trauring Date: Mon, 3 May 2021 11:13:27 -0400 Subject: [PATCH] Tests pass on Python 3. --- src/allmydata/scripts/tahoe_mv.py | 3 +++ src/allmydata/test/cli/test_mv.py | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/allmydata/scripts/tahoe_mv.py b/src/allmydata/scripts/tahoe_mv.py index bdaf134ff..580475c91 100644 --- a/src/allmydata/scripts/tahoe_mv.py +++ b/src/allmydata/scripts/tahoe_mv.py @@ -1,5 +1,7 @@ from __future__ import print_function +from past.builtins import unicode + import re from urllib.parse import quote as url_quote import json @@ -47,6 +49,7 @@ def mv(options, mode="move"): if path: to_url += "/" + escape_path(path) + from_path = unicode(from_path, "utf-8") if to_url.endswith("/"): # "mv foo.txt bar/" == "mv foo.txt bar/foo.txt" to_url += escape_path(from_path[from_path.rfind("/")+1:]) diff --git a/src/allmydata/test/cli/test_mv.py b/src/allmydata/test/cli/test_mv.py index 9d1a64974..21378c353 100644 --- a/src/allmydata/test/cli/test_mv.py +++ b/src/allmydata/test/cli/test_mv.py @@ -10,10 +10,10 @@ class Mv(GridTestMixin, CLITestMixin, unittest.TestCase): self.basedir = "cli/Mv/mv_behavior" self.set_up_grid(oneshare=True) fn1 = os.path.join(self.basedir, "file1") - DATA1 = "Nuclear launch codes" + DATA1 = b"Nuclear launch codes" fileutil.write(fn1, DATA1) fn2 = os.path.join(self.basedir, "file2") - DATA2 = "UML diagrams" + DATA2 = b"UML diagrams" fileutil.write(fn2, DATA2) # copy both files to the grid d = self.do_cli("create-alias", "tahoe") @@ -104,11 +104,11 @@ class Mv(GridTestMixin, CLITestMixin, unittest.TestCase): self.basedir = "cli/Mv/mv_error_if_DELETE_fails" self.set_up_grid(oneshare=True) fn1 = os.path.join(self.basedir, "file1") - DATA1 = "Nuclear launch codes" + DATA1 = b"Nuclear launch codes" fileutil.write(fn1, DATA1) original_do_http = tahoe_mv.do_http - def mock_do_http(method, url, body=""): + def mock_do_http(method, url, body=b""): if method == "DELETE": class FakeResponse(object): def read(self):