Skip to content

Commit

Permalink
edits in travis to enable python 3.7 and 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
TimMcCauley committed Apr 14, 2019
1 parent d0f310d commit 3d371a1
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 24 deletions.
16 changes: 9 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
dist: xenial # required for Python >= 3.7
language: python

python:
- "3.5"
- "3.6"
- "pypy3"
# PyPy versions
- "pypy3.5-6.0"
matrix:
include:
- python: 3.7
- python: 3.8-dev
dist: xenial
sudo: true

install:
- pip install coverage
- pip install coveralls
- pip install -r requirements_dev.txt

matrix:
allow_failures:
- python: "3.8-dev"
dist: xenial
sudo: true

script:
- nosetests --with-coverage --cover-erase --cover-package=routingpy -v

Expand Down
44 changes: 27 additions & 17 deletions tests/test_mapbox_osrm.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

import responses
from copy import deepcopy
import json
from collections import Counter


class MapboxOSRMTest(_test.TestCase):
Expand All @@ -49,16 +51,20 @@ def test_full_directions(self):
headers={'Content-Type': 'application/x-www-form-urlencoded'})

routes = self.client.directions(**query)

self.assertEqual(1, len(responses.calls))
self.assertURLEqual(
"coordinates=8.688641%2C49.420577%3B8.680916%2C49.415776%3B8.780916%2C49.445776&"
"radiuses=500%3B500%3B500&bearings=50%2C50%3B50%2C50%3B50%2C50&alternatives=false&steps=true&"
"continue_straight=true&annotations=duration%2Cdistance%2Cspeed&geometries=geojson&"
"overview=simplified&exclude=motorway&approaches=%3Bcurb%3Bcurb%3Bcurb&banner_instuctions=true&"
"language=de&roundabout_exits=true&voide_instructions=true&voice_units=metric&"
"waypoint_names=a%3Bb%3Bc&waypoint_targets=%3B8.688641%2C49.420577%3B8.680916%2C49.415776%3B"
"8.780916%2C49.445776", responses.calls[0].request.body)

# python 3.5 dict doesn't guarantee the order when added input to x-www-form-urlencoded
expected_url = (
'coordinates=8.688641%2C49.420577%3B8.680916%2C49.415776%3B8.780916%2C49.445776&'
'radiuses=500%3B500%3B500&bearings=50%2C50%3B50%2C50%3B50%2C50&alternatives=false&steps=true&'
'continue_straight=true&annotations=duration%2Cdistance%2Cspeed&geometries=geojson&'
'overview=simplified&exclude=motorway&approaches=%3Bcurb%3Bcurb%3Bcurb&banner_instuctions=true&'
'language=de&roundabout_exits=true&voide_instructions=true&voice_units=metric&'
'waypoint_names=a%3Bb%3Bc&waypoint_targets=%3B8.688641%2C49.420577%3B8.680916%2C49.415776%3B'
'8.780916%2C49.445776').split("&")
called_url = responses.calls[0].request.body.split("&")
self.assertTrue(Counter(expected_url) == Counter(called_url))

self.assertIsInstance(routes, Direction)
self.assertIsInstance(routes.geometry, list)
self.assertIsInstance(routes.duration, int)
Expand All @@ -81,14 +87,18 @@ def test_full_directions_alternatives(self):
routes = self.client.directions(**query)

self.assertEqual(1, len(responses.calls))
self.assertURLEqual(
"coordinates=8.688641%2C49.420577%3B8.680916%2C49.415776%3B8.780916%2C49.445776&"
"radiuses=500%3B500%3B500&bearings=50%2C50%3B50%2C50%3B50%2C50&alternatives=3&steps=true&"
"continue_straight=true&annotations=duration%2Cdistance%2Cspeed&geometries=geojson&"
"overview=simplified&exclude=motorway&approaches=%3Bcurb%3Bcurb%3Bcurb&banner_instuctions=true&"
"language=de&roundabout_exits=true&voide_instructions=true&voice_units=metric&"
"waypoint_names=a%3Bb%3Bc&waypoint_targets=%3B8.688641%2C49.420577%3B8.680916%2C49.415776%3B"
"8.780916%2C49.445776", responses.calls[0].request.body)

# python 3.5 dict doesn't guarantee the order when added input to x-www-form-urlencoded
expected_url = (
'coordinates=8.688641%2C49.420577%3B8.680916%2C49.415776%3B8.780916%2C49.445776&'
'radiuses=500%3B500%3B500&bearings=50%2C50%3B50%2C50%3B50%2C50&alternatives=3&steps=true&'
'continue_straight=true&annotations=duration%2Cdistance%2Cspeed&geometries=geojson&'
'overview=simplified&exclude=motorway&approaches=%3Bcurb%3Bcurb%3Bcurb&banner_instuctions=true&'
'language=de&roundabout_exits=true&voide_instructions=true&voice_units=metric&'
'waypoint_names=a%3Bb%3Bc&waypoint_targets=%3B8.688641%2C49.420577%3B8.680916%2C49.415776%3B'
'8.780916%2C49.445776').split("&")
called_url = responses.calls[0].request.body.split("&")
self.assertTrue(Counter(expected_url) == Counter(called_url))

self.assertIsInstance(routes, Directions)
self.assertEqual(1, len(routes))
Expand Down

0 comments on commit 3d371a1

Please sign in to comment.