Skip to content

Commit

Permalink
fix testing
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrDlouhy committed Feb 8, 2016
1 parent db119df commit efa602f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ script:
- coverage run manage.py test

python:
- "2.6"
- "2.7"
- "3.4"
- "3.5"
Expand Down
2 changes: 1 addition & 1 deletion django_gpxpy/gpx_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ def parse_gpx(track):
if len(track_list_of_points) > 1:
multiline.append(LineString(track_list_of_points))
return MultiLineString(multiline)
except gpxpy.GPXException as e:
except gpxpy.gpx.GPXException as e:
logger.error("Valid GPX file: %s" % e)
raise ValidationError(u"Vadný GPX soubor: %s" % e)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
'gpxpy',
],
classifiers=[
"Development Status :: 1 - Pre-Alpha",
"Development Status :: 2 - Pre-Alpha",
"Framework :: Django",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
Expand Down
11 changes: 10 additions & 1 deletion tests/test.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
from django_gpxpy.gpx_parse import parse_gpx
from django.test import TestCase
from django.core.exceptions import ValidationError

class DjangoGpxPyTests(TestCase):
def test_admin_filter_RelatedFieldRadioFilter(self):
def test_gpx_parsing(self):
"""
test if the admin page with RelatedFieldRadioFilter filters loads succesfully
"""
with open("tests/test_data/test_track.gpx", "r") as f:
multilinestring = parse_gpx(f)
self.assertEquals(multilinestring.num_geom, 26)

def test_bad_file_parsing(self):
"""
test if the admin page with RelatedFieldRadioFilter filters loads succesfully
"""
with self.assertRaises(ValidationError):
with open("tests/test_data/test_bad_file.gpx", "r") as f:
multilinestring = parse_gpx(f)
1 change: 1 addition & 0 deletions tests/test_data/test_bad_file.gpx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
</gpx>

0 comments on commit efa602f

Please sign in to comment.