Skip to content

Commit b2f50ec

Browse files
committed
Convert to use CircleCI and run tests against Django 2.1/Python 3.7
1 parent acf8867 commit b2f50ec

File tree

13 files changed

+135
-51
lines changed

13 files changed

+135
-51
lines changed

.circleci/config.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
version: 2
2+
jobs:
3+
test-python35:
4+
docker:
5+
- image: python:3.5-alpine
6+
- image: postgres:11.0
7+
environment:
8+
POSTGRES_DB: 'localizedfields'
9+
POSTGRES_USER: 'localizedfields'
10+
POSTGRES_PASSWORD: 'localizedfields'
11+
steps:
12+
- checkout
13+
- run:
14+
name: Install packages
15+
command: apk add postgresql-libs gcc musl-dev postgresql-dev git
16+
- run:
17+
name: Install Python packages
18+
command: pip install -r requirements/test.txt
19+
- run:
20+
name: Run tests
21+
command: tox -e 'py35-dj{111,20,21}'
22+
environment:
23+
DATABASE_URL: 'postgres://localizedfields:localizedfields@localhost:5432/localizedfields'
24+
25+
test-python36:
26+
docker:
27+
- image: python:3.6-alpine
28+
- image: postgres:11.0
29+
environment:
30+
POSTGRES_DB: 'localizedfields'
31+
POSTGRES_USER: 'localizedfields'
32+
POSTGRES_PASSWORD: 'localizedfields'
33+
steps:
34+
- checkout
35+
- run:
36+
name: Install packages
37+
command: apk add postgresql-libs gcc musl-dev postgresql-dev git
38+
- run:
39+
name: Install Python packages
40+
command: pip install -r requirements/test.txt
41+
- run:
42+
name: Run tests
43+
command: tox -e 'py36-dj{111,20,21}'
44+
environment:
45+
DATABASE_URL: 'postgres://localizedfields:localizedfields@localhost:5432/localizedfields'
46+
47+
test-python37:
48+
docker:
49+
- image: python:3.7-alpine
50+
- image: postgres:11.0
51+
environment:
52+
POSTGRES_DB: 'localizedfields'
53+
POSTGRES_USER: 'localizedfields'
54+
POSTGRES_PASSWORD: 'localizedfields'
55+
steps:
56+
- checkout
57+
- run:
58+
name: Install packages
59+
command: apk add postgresql-libs gcc musl-dev postgresql-dev git
60+
- run:
61+
name: Install Python packages
62+
command: pip install -r requirements/test.txt
63+
- run:
64+
name: Run tests
65+
command: tox -e 'py37-dj{111,20,21}'
66+
environment:
67+
DATABASE_URL: 'postgres://localizedfields:localizedfields@localhost:5432/localizedfields'
68+
69+
lint:
70+
docker:
71+
- image: python:3.5-alpine
72+
steps:
73+
- checkout
74+
- run:
75+
name: Install packages
76+
command: apk add postgresql-libs gcc musl-dev postgresql-dev git
77+
- run:
78+
name: Install Python packages
79+
command: pip install -r requirements/test.txt
80+
- run:
81+
name: Lint code
82+
command: python setup.py lint
83+
84+
85+
workflows:
86+
version: 2
87+
build:
88+
jobs:
89+
- test-python35
90+
- test-python36
91+
- test-python37
92+
- lint

.coveragerc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
[run]
22
include = localized_fields/*
33
omit = *migrations*, *tests*
4-
plugins =
5-
django_coverage_plugin

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Ignore virtual environments
22
env/
3+
.env/
34

45
# Ignore Python byte code cache
56
*.pyc

.scrutinizer.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

requirements/test.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22

33
django-autoslug==1.9.3
44
django-bleach==0.3.0
5-
django-coverage-plugin==1.3.1
65
psycopg2==2.7.3.2
76
pylint==1.8.1
87
pylint-common==0.2.5
98
pylint-django==0.8.0
109
pylint-plugin-utils==0.2.6
1110
coverage==4.4.2
12-
django-coverage-plugin==1.3.1
13-
flake8==3.5.0
11+
flake8==3.6.0
1412
pep8==1.7.1
1513
dj-database-url==0.4.2
1614
tox==2.9.1

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[flake8]
22
max-line-length = 120
3+
ignore = E252, W605
34
exclude = env,.tox,.git,config/settings,*/migrations/*,*/static/CACHE/*,docs,node_modules
45

56
[pep8]

setup.py

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,39 @@
11
import os
2+
import distutils.cmd
3+
import subprocess
24

35
from setuptools import find_packages, setup
46

7+
8+
class BaseCommand(distutils.cmd.Command):
9+
user_options = []
10+
11+
def initialize_options(self):
12+
pass
13+
14+
def finalize_options(self):
15+
pass
16+
17+
18+
def create_command(text, commands):
19+
"""Creates a custom setup.py command."""
20+
21+
class CustomCommand(BaseCommand):
22+
description = text
23+
24+
def run(self):
25+
for cmd in commands:
26+
subprocess.check_call(cmd)
27+
28+
return CustomCommand
29+
30+
531
with open(os.path.join(os.path.dirname(__file__), 'README.rst'), encoding='utf-8') as readme:
632
README = readme.read()
733

834
setup(
935
name='django-localized-fields',
10-
version='5.0a3',
36+
version='5.0a5',
1137
packages=find_packages(exclude=['tests']),
1238
include_package_data=True,
1339
license='MIT License',
@@ -18,7 +44,7 @@
1844
author_email='[email protected]',
1945
keywords=['django', 'localized', 'language', 'models', 'fields'],
2046
install_requires=[
21-
'django-postgres-extra>=1.21a11',
47+
'django-postgres-extra>=1.21a14',
2248
'Django>=1.11',
2349
'deprecation==2.0.3'
2450
],
@@ -32,5 +58,11 @@
3258
'Programming Language :: Python :: 3.5',
3359
'Topic :: Internet :: WWW/HTTP',
3460
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
35-
]
61+
],
62+
cmdclass={
63+
'lint': create_command(
64+
'Lints the code',
65+
[['flake8', 'setup.py', 'localized_fields', 'tests']],
66+
),
67+
},
3668
)

tests/test_field.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ def test_init():
3333
field = LocalizedField(required=False)
3434
assert field.required == []
3535

36-
3736
@staticmethod
3837
def test_from_db_value():
3938
"""Tests whether the :see:from_db_value function

tests/test_form.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ def test_init():
4040
for field in form.fields:
4141
assert not field.required
4242

43-
4443
@staticmethod
4544
def test_compress():
4645
"""Tests whether the :see:compress function

tests/test_integer_field.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from django.db import connection
55
from django.utils import translation
66

7-
from localized_fields.value import LocalizedIntegerValue
87
from localized_fields.fields import LocalizedIntegerField
98

109
from .fake_model import get_fake_model
@@ -149,7 +148,7 @@ def test_none_if_illegal_value_stored(self):
149148

150149
with connection.cursor() as cursor:
151150
table_name = self.TestModel._meta.db_table
152-
cursor.execute("update %s set score = 'en=>haha'" % table_name);
151+
cursor.execute("update %s set score = 'en=>haha'" % table_name)
153152

154153
obj.refresh_from_db()
155154
assert obj.score.get(settings.LANGUAGE_CODE) is None

0 commit comments

Comments
 (0)