Skip to content

Commit 98fe36c

Browse files
committed
Some pep8 fixes and changes to tox and travis test plans
Tests cover django 1.8, 1.10
1 parent b014052 commit 98fe36c

8 files changed

Lines changed: 34 additions & 55 deletions

File tree

.travis.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,19 @@ language: python
22

33
python:
44
- "2.7"
5-
- "3.4"
65
- "3.5"
76

87
env:
9-
- DJANGO="django>=1.9,<1.10"
8+
- DJANGO="django>=1.10,<1.11"
109
- DJANGO="django>=1.8,<1.9"
11-
- DJANGO="django>=1.7,<1.8"
1210

13-
matrix:
14-
exclude:
15-
- python: "3.5"
16-
env: DJANGO="django>=1.7,<1.8"
11+
#matrix:
12+
# exclude:
13+
# - python: "2.7"
14+
# env: DJANGO="django>=1.11,<1.12"
1715

1816
install:
19-
- pip install -q $DJANGO six https://github.com/python-odin/odin/archive/master.zip
17+
- pip install -q $DJANGO six odin<=1.0
2018
- pip install coveralls
2119

2220
script: coverage run django_test_runner/__main__.py baldr

baldr/api/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@
1515
from odin.exceptions import CodecDecodeError, ValidationError
1616
from odin.utils import getmeta
1717

18-
from .constants import * # noqa
19-
from .route_decorators import * # noqa
2018
from .. import content_type_resolvers
2119
from ..resources import Error
2220
from ..exceptions import ImmediateErrorHttpResponse, ImmediateHttpResponse
2321

22+
from .constants import * # noqa
23+
from .route_decorators import * # noqa
24+
25+
2426
logger = logging.getLogger(__name__)
2527

2628
CODECS = {json_codec.CONTENT_TYPE: json_codec}
@@ -71,7 +73,7 @@ def url(self, regex, view, kwargs=None, name=None, prefix=''):
7173
Regex should be a part regex that applies only to the targeted method ie::
7274
7375
self.url("(\d+)", ...)
74-
76+
7577
"""
7678
if regex:
7779
return url(r'^%s/%s/?$' % (self.url_prefix + self.api_name.lower(), regex), view, kwargs, name, prefix)

baldr/api/constants.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@
1515

1616
PATH_TYPE_COLLECTION = 'collection'
1717
PATH_TYPE_RESOURCE = 'resource'
18+
19+
20+
__all__ = [i for i in locals() if i.isupper()]

baldr/api/route_decorators.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,14 @@ def inner(f):
6363

6464
return inner(func) if func else inner
6565

66+
6667
collection = collection_action = action = route
6768

6869

6970
def resource_route(func=None, name=None, method=constants.GET, resource=None):
7071
return route(func, name, constants.PATH_TYPE_RESOURCE, method, resource)
7172

73+
7274
detail_route = detail_action = resource_route
7375

7476

django_test_runner/__main__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#! /usr/bin/env python
22
# -*- coding: utf-8 -*-
3+
34
import os
45
import sys
5-
from optparse import OptionParser
66
import django
7+
8+
from optparse import OptionParser
79
from django.conf import settings
810
from django.core.management import call_command
911

@@ -79,5 +81,6 @@ def main():
7981

8082
call_command("test", app_name)
8183

84+
8285
if __name__ == "__main__":
8386
main()

django_test_runner/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# -*- coding: utf-8 -*-
22
from django.conf.urls import patterns
3+
34
urlpatterns = patterns('')

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
six
22
odin >=1.0
33
django >=1.8
4-

tox.ini

Lines changed: 13 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -5,66 +5,37 @@
55
#
66
[tox]
77
envlist =
8-
py27-django17,
9-
py34-django17,
108
py27-django18,
11-
py34-django18,
12-
py27-django19,
13-
py34-django19,
14-
pep8,
15-
py3pep8
9+
py35-django18,
10+
py35-django110,
11+
pep8
1612

1713
[testenv]
1814
commands = coverage run django_test_runner/__main__.py baldr
1915

20-
[testenv:py27-django17]
21-
basepython = python2.7
22-
deps =
23-
coverage
24-
https://github.com/timsavage/odin/archive/master.zip
25-
django>=1.7,<1.8
26-
27-
[testenv:py34-django17]
28-
basepython = python3.4
29-
deps =
30-
coverage
31-
https://github.com/timsavage/odin/archive/master.zip
32-
django>=1.7,<1.8
33-
3416
[testenv:py27-django18]
3517
basepython = python2.7
3618
deps =
3719
coverage
38-
https://github.com/timsavage/odin/archive/master.zip
39-
django>=1.8,<1.9
20+
odin >=1.0
21+
django >=1.8,<1.9
4022

41-
[testenv:py34-django18]
42-
basepython = python3.4
23+
[testenv:py35-django18]
24+
basepython = python3.5
4325
deps =
4426
coverage
45-
https://github.com/timsavage/odin/archive/master.zip
27+
odin >=1.0
4628
django>=1.8,<1.9
4729

48-
[testenv:py27-django19]
49-
basepython = python2.7
50-
deps =
51-
coverage
52-
https://github.com/timsavage/odin/archive/master.zip
53-
django>=1.9,<1.10
54-
55-
[testenv:py34-django19]
56-
basepython = python3.4
30+
[testenv:py35-django110]
31+
basepython = python3.5
5732
deps =
5833
coverage
59-
https://github.com/timsavage/odin/archive/master.zip
60-
django>=1.9,<1.10
34+
odin >=1.0
35+
django>=1.10,<1.11
6136

6237
[testenv:pep8]
63-
deps = flake8
64-
commands = flake8 .
65-
66-
[testenv:py3pep8]
67-
basepython = python3.4
38+
basepython = python3.5
6839
deps = flake8
6940
commands = flake8 .
7041

0 commit comments

Comments
 (0)