diff --git a/test/test_convert.py b/test/test_convert.py index 237cafdeb..69a23afd7 100644 --- a/test/test_convert.py +++ b/test/test_convert.py @@ -28,6 +28,15 @@ from beets.mediafile import MediaFile from beets import util +def shell_quote(text): + if sys.version_info[0] < 3: + import pipes + return pipes.quote(text) + else: + import shlex + return shlex.quote(text) + + class TestHelper(helper.TestHelper): def tagged_copy_cmd(self, tag): @@ -40,7 +49,7 @@ class TestHelper(helper.TestHelper): # A Python script that copies the file and appends a tag. stub = os.path.join(_common.RSRC, b'convert_stub.py').decode('utf-8') - return u"'{}' '{}' $source $dest {}".format(sys.executable, stub, tag) + return u"{} {} $source $dest {}".format(shell_quote(sys.executable), shell_quote(stub), tag) def assertFileTag(self, path, tag): # noqa """Assert that the path is a file and the files content ends with `tag`.