diff options
author | David Robillard <d@drobilla.net> | 2019-10-23 01:21:58 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-10-23 01:21:58 +0200 |
commit | 36e74a76e6fb45191d3f5d7a0310f869abe813a1 (patch) | |
tree | 1218a356b6437de16becd600b28d3b0beacf7abf /bindings | |
parent | bf9fc44b3ba43065de6eb7098a4a576425490197 (diff) | |
download | lilv-36e74a76e6fb45191d3f5d7a0310f869abe813a1.tar.gz lilv-36e74a76e6fb45191d3f5d7a0310f869abe813a1.tar.bz2 lilv-36e74a76e6fb45191d3f5d7a0310f869abe813a1.zip |
Fix Python tests on Python2
Diffstat (limited to 'bindings')
-rw-r--r-- | bindings/test/python/test_api.py | 20 |
1 files changed, 15 insertions, 5 deletions
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)) |