Skip to content

Commit daf4562

Browse files
committed
Fixed relative import
1 parent 10331f3 commit daf4562

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

test/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@
2525
except ImportError: # Python 2
2626
from urlparse import urlparse, parse_qsl
2727

28+
# For relative imports to work in Python 3.6
29+
import os
30+
import sys
31+
32+
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
33+
2834

2935
class TestCase(unittest.TestCase):
3036

test/test_client.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import time
2525

2626
import openrouteservice
27-
from .test_helper import *
27+
from test.test_helper import *
2828
import test as _test
2929

3030
class ClientTest(_test.TestCase):
@@ -73,10 +73,10 @@ def test_raise_timeout_retriable_requests(self):
7373
json=valid_query,
7474
status=503,
7575
content_type='application/json')
76-
77-
client = openrouteservice.Client(key=self.key,
76+
77+
client = openrouteservice.Client(key=self.key,
7878
retry_timeout=retry_timeout)
79-
79+
8080
start = time.time()
8181
with self.assertRaises(openrouteservice.exceptions.Timeout):
8282
client.directions(**valid_query)
@@ -94,15 +94,15 @@ def test_host_override_with_parameters(self):
9494

9595
client = openrouteservice.Client(base_url="https://foo.com")
9696
client.request("/bar", {'bunny':'pretty', 'fox':'prettier'})
97-
97+
9898
self.assertURLEqual("https://foo.com/bar?bunny=pretty&fox=prettier",
9999
responses.calls[0].request.url)
100100
self.assertEqual(1, len(responses.calls))
101-
101+
102102
@responses.activate
103103
def test_dry_run(self):
104104
# Test that nothing is requested when dry_run is 'true'
105-
105+
106106
responses.add(responses.GET,
107107
'https://api.openrouteservice.org/directions',
108108
body='{"status":"OK","results":[]}',
@@ -112,7 +112,7 @@ def test_dry_run(self):
112112
req = self.client.request(get_params={'format_out': 'geojson'},
113113
url='directions/',
114114
dry_run='true')
115-
115+
116116
self.assertEqual(0, len(responses.calls))
117117

118118
@responses.activate

test/test_geocode.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import responses
2323

2424
import test as _test
25-
from .test_helper import ENDPOINT_DICT
25+
from test.test_helper import ENDPOINT_DICT
2626

2727

2828
class GeocodingPeliasTest(_test.TestCase):

test/test_isochrones.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"""Tests for the distance matrix module."""
1919
import responses
2020
import test as _test
21-
from .test_helper import PARAM_POINT, ENDPOINT_DICT
21+
from test.test_helper import PARAM_POINT, ENDPOINT_DICT
2222

2323

2424
class IsochronesTest(_test.TestCase):

0 commit comments

Comments
 (0)