Skip to content

Commit

Permalink
add tests and other infrastructure
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrDlouhy committed Feb 8, 2016
1 parent 5bb7594 commit 14b02e9
Show file tree
Hide file tree
Showing 9 changed files with 1,047 additions and 1 deletion.
25 changes: 25 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
language: python
install:
- pip install coveralls coverage
- pip install -q "$DJANGO"
script:
- coverage run manage.py test

python:
- "2.6"
- "2.7"
- "3.4"
- "3.5"

env:
- DJANGO="Django>=1.8,<1.9"
- DJANGO="Django>=1.9,<1.10"
- DJANGO='https://github.com/django/django/archive/master.tar.gz'

matrix:
allow_failures:
- env: DJANGO='https://github.com/django/django/archive/master.tar.gz'

after_script:
- cd test_denorm_project/
- coveralls
Empty file added django_gpxpy/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion gpxpy/gpx_parse.py → 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.gpx.GPXException as e:
except gpxpy.GPXException as e:
logger.error("Valid GPX file: %s" % e)
raise ValidationError(u"Vadný GPX soubor: %s" % e)
10 changes: 10 additions & 0 deletions manage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python
import os
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.settings")

from django.core.management import execute_from_command_line

execute_from_command_line(sys.argv)
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

from setuptools import setup

Expand Down
Empty file added tests/__init__.py
Empty file.
11 changes: 11 additions & 0 deletions tests/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import os

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
TEST_RUNNER = "django.test.runner.DiscoverRunner"
SECRET_KEY = 'i%&(axb!!5yfg6kv$m*ytf9i-0)z-&1y-wkmv^oz#6l&$*+!v6'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
11 changes: 11 additions & 0 deletions tests/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from django_gpxpy.gpx_parse import parse_gpx
from django.test import TestCase

class DjangoGpxPyTests(TestCase):
def test_admin_filter_RelatedFieldRadioFilter(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)
988 changes: 988 additions & 0 deletions tests/test_data/test_track.gpx

Large diffs are not rendered by default.

0 comments on commit 14b02e9

Please sign in to comment.