From 36e74a76e6fb45191d3f5d7a0310f869abe813a1 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 23 Oct 2019 01:21:58 +0200 Subject: Fix Python tests on Python2 --- bindings/test/python/test_api.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'bindings') diff --git a/bindings/test/python/test_api.py b/bindings/test/python/test_api.py index 0b06292..aa6545a 100644 --- a/bindings/test/python/test_api.py +++ b/bindings/test/python/test_api.py @@ -18,11 +18,18 @@ import os import sys import unittest -from urllib.parse import urljoin -from urllib.request import pathname2url - path = os.path.abspath("bindings/bindings_test_plugin.lv2/") -location = urljoin("file:", pathname2url(path) + "/") + +if sys.version_info[0] == 2: + import urllib + import urlparse + + location = urlparse.urljoin("file:", urllib.pathname2url(path) + "/") +else: + from urllib.parse import urljoin + from urllib.request import pathname2url + + location = urljoin("file:", pathname2url(path) + "/") class NodeTests(unittest.TestCase): @@ -265,7 +272,10 @@ class PluginTests(unittest.TestCase): self.assertEqual("input", port.get_symbol()) self.assertEqual("Input", port.get_name()) self.assertEqual( - [str(self.world.ns.lv2.ControlPort), str(self.world.ns.lv2.InputPort)], + [ + str(self.world.ns.lv2.ControlPort), + str(self.world.ns.lv2.InputPort), + ], sorted(list(map(str, port.get_classes()))), ) self.assertTrue(port.is_a(self.world.ns.lv2.ControlPort)) -- cgit v1.2.1