Skip to content

Commit 775d2e3

Browse files
authored
Update travis and tox (#667)
* Update travis and tox * Use xenial distribution * Don't install coveralls twice * Add black and flake8 tox commands * Remove Python 3.5 test for Django master * Fix indent * Ignore migrations * Remove black for now * Run black formatting (#668) * Run black format * Update makefile * Add black to travis build
1 parent 44e9b0d commit 775d2e3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+328
-436
lines changed

.travis.yml

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,58 @@
11
language: python
2-
sudo: required
2+
cache: pip
33
dist: xenial
44

5-
python:
6-
- 2.7
7-
- 3.4
8-
- 3.5
9-
- 3.6
10-
- 3.7
11-
12-
env:
13-
matrix:
14-
- DJANGO=1.11
15-
- DJANGO=2.1
16-
- DJANGO=2.2
17-
- DJANGO=master
18-
195
install:
20-
- TOX_ENV=py${TRAVIS_PYTHON_VERSION}-django${DJANGO}
21-
- pip install tox
22-
- tox -e $TOX_ENV --notest
23-
script:
24-
- tox -e $TOX_ENV
6+
- pip install tox tox-travis
257

26-
after_success:
27-
- tox -e $TOX_ENV -- pip install coveralls
28-
- tox -e $TOX_ENV -- coveralls $COVERALLS_OPTION
8+
script:
9+
- tox
10+
11+
after_success:
12+
- pip install coveralls
13+
- coveralls
2914

3015
matrix:
3116
fast_finish: true
3217
include:
33-
- python: 3.5
34-
script: tox -e lint
35-
exclude:
3618
- python: 2.7
19+
env: DJANGO=1.11
20+
21+
- python: 3.5
22+
env: DJANGO=1.11
23+
- python: 3.5
24+
env: DJANGO=2.0
25+
- python: 3.5
3726
env: DJANGO=2.1
38-
- python: 2.7
27+
- python: 3.5
3928
env: DJANGO=2.2
40-
- python: 2.7
41-
env: DJANGO=master
42-
- python: 3.4
29+
30+
- python: 3.6
31+
env: DJANGO=1.11
32+
- python: 3.6
33+
env: DJANGO=2.0
34+
- python: 3.6
4335
env: DJANGO=2.1
44-
- python: 3.4
36+
- python: 3.6
4537
env: DJANGO=2.2
46-
- python: 3.4
38+
- python: 3.6
4739
env: DJANGO=master
48-
- python: 3.5
49-
env: DJANGO=master
50-
- python: 3.7
51-
env: DJANGO=1.10
40+
5241
- python: 3.7
5342
env: DJANGO=1.11
54-
allow_failures:
5543
- python: 3.7
44+
env: DJANGO=2.0
45+
- python: 3.7
46+
env: DJANGO=2.1
47+
- python: 3.7
48+
env: DJANGO=2.2
49+
- python: 3.7
50+
env: DJANGO=master
51+
52+
- python: 3.7
53+
env: TOXENV=black,flake8
54+
55+
allow_failures:
5656
- env: DJANGO=master
5757

5858
deploy:

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ tests:
55
py.test graphene_django --cov=graphene_django -vv
66

77
format:
8-
black graphene_django
8+
black --exclude "/migrations/" graphene_django examples
99

1010
lint:
11-
flake8 graphene_django
11+
flake8 graphene_django examples

examples/cookbook-plain/cookbook/ingredients/admin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
@admin.register(Ingredient)
77
class IngredientAdmin(admin.ModelAdmin):
8-
list_display = ('id', 'name', 'category')
9-
list_editable = ('name', 'category')
8+
list_display = ("id", "name", "category")
9+
list_editable = ("name", "category")
1010

1111

1212
admin.site.register(Category)

examples/cookbook-plain/cookbook/ingredients/apps.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33

44
class IngredientsConfig(AppConfig):
5-
name = 'cookbook.ingredients'
6-
label = 'ingredients'
7-
verbose_name = 'Ingredients'
5+
name = "cookbook.ingredients"
6+
label = "ingredients"
7+
verbose_name = "Ingredients"

examples/cookbook-plain/cookbook/ingredients/models.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
class Category(models.Model):
55
class Meta:
6-
verbose_name_plural = 'Categories'
6+
verbose_name_plural = "Categories"
7+
78
name = models.CharField(max_length=100)
89

910
def __str__(self):
@@ -13,7 +14,9 @@ def __str__(self):
1314
class Ingredient(models.Model):
1415
name = models.CharField(max_length=100)
1516
notes = models.TextField(null=True, blank=True)
16-
category = models.ForeignKey(Category, related_name='ingredients', on_delete=models.CASCADE)
17+
category = models.ForeignKey(
18+
Category, related_name="ingredients", on_delete=models.CASCADE
19+
)
1720

1821
def __str__(self):
1922
return self.name

examples/cookbook-plain/cookbook/ingredients/schema.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,20 @@ class Meta:
1515

1616

1717
class Query(object):
18-
category = graphene.Field(CategoryType,
19-
id=graphene.Int(),
20-
name=graphene.String())
18+
category = graphene.Field(CategoryType, id=graphene.Int(), name=graphene.String())
2119
all_categories = graphene.List(CategoryType)
2220

23-
ingredient = graphene.Field(IngredientType,
24-
id=graphene.Int(),
25-
name=graphene.String())
21+
ingredient = graphene.Field(
22+
IngredientType, id=graphene.Int(), name=graphene.String()
23+
)
2624
all_ingredients = graphene.List(IngredientType)
2725

2826
def resolve_all_categories(self, context):
2927
return Category.objects.all()
3028

3129
def resolve_all_ingredients(self, context):
3230
# We can easily optimize query count in the resolve method
33-
return Ingredient.objects.select_related('category').all()
31+
return Ingredient.objects.select_related("category").all()
3432

3533
def resolve_category(self, context, id=None, name=None):
3634
if id is not None:
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
21
# Create your tests here.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
21
# Create your views here.

examples/cookbook-plain/cookbook/recipes/apps.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33

44
class RecipesConfig(AppConfig):
5-
name = 'cookbook.recipes'
6-
label = 'recipes'
7-
verbose_name = 'Recipes'
5+
name = "cookbook.recipes"
6+
label = "recipes"
7+
verbose_name = "Recipes"

examples/cookbook-plain/cookbook/recipes/models.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,23 @@
66
class Recipe(models.Model):
77
title = models.CharField(max_length=100)
88
instructions = models.TextField()
9+
910
def __str__(self):
1011
return self.title
1112

1213

1314
class RecipeIngredient(models.Model):
14-
recipe = models.ForeignKey(Recipe, related_name='amounts', on_delete=models.CASCADE)
15-
ingredient = models.ForeignKey(Ingredient, related_name='used_by', on_delete=models.CASCADE)
15+
recipe = models.ForeignKey(Recipe, related_name="amounts", on_delete=models.CASCADE)
16+
ingredient = models.ForeignKey(
17+
Ingredient, related_name="used_by", on_delete=models.CASCADE
18+
)
1619
amount = models.FloatField()
17-
unit = models.CharField(max_length=20, choices=(
18-
('unit', 'Units'),
19-
('kg', 'Kilograms'),
20-
('l', 'Litres'),
21-
('st', 'Shots'),
22-
))
20+
unit = models.CharField(
21+
max_length=20,
22+
choices=(
23+
("unit", "Units"),
24+
("kg", "Kilograms"),
25+
("l", "Litres"),
26+
("st", "Shots"),
27+
),
28+
)

0 commit comments

Comments
 (0)