Skip to content

Commit 6dd0a9a

Browse files
author
Jaap Roes
committed
Ensure Python 2.7 compatibility
1 parent 3c4f0a3 commit 6dd0a9a

File tree

7 files changed

+23
-5
lines changed

7 files changed

+23
-5
lines changed

.github/workflows/python.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
max-parallel: 4
1515
matrix:
16-
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
16+
python-version: ['2.7', '3.6', '3.7', '3.8', '3.9', '3.10']
1717

1818
steps:
1919
- uses: actions/checkout@v2

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ def exec_file(filepath, globalz=None, localz=None):
4545
zip_safe=False,
4646
include_package_data=True,
4747
install_requires=[
48-
'django-appconf>=0.5',
48+
"django-appconf>=0.5,<1.0.4; python_version<'3'",
49+
"django-appconf; python_version>'3'",
4950
'pilkit>=0.2.0',
5051
'six',
5152
],

test-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Test requirements
2+
mock; python_version<'3'
23
beautifulsoup4
34
Pillow
45
pytest

tests/test_cachefiles.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import pytest
22

3-
from unittest import mock
3+
try:
4+
from unittest import mock
5+
except ImportError:
6+
import mock
7+
48
from django.conf import settings
59
from hashlib import md5
610
from imagekit.cachefiles import ImageCacheFile, LazyImageCacheFile

tests/test_no_extra_queries.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
from unittest.mock import Mock, PropertyMock, patch
1+
try:
2+
from unittest.mock import Mock, PropertyMock, patch
3+
except:
4+
from mock import Mock, PropertyMock, patch
5+
26
from .models import Photo
37

48

tests/test_optimistic_strategy.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
from imagekit.cachefiles import ImageCacheFile
2-
from unittest.mock import Mock
2+
3+
try:
4+
from unittest.mock import Mock
5+
except:
6+
from mock import Mock
7+
38
from .utils import create_image
49
from django.core.files.storage import FileSystemStorage
510
from imagekit.cachefiles.backends import Simple as SimpleCFBackend

tox.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
[tox]
22
envlist =
3+
py27-django111
34
py{36,37,38,39,310}-django{22,31,32},
45
py310-djangomain,
56
coverage-report
67

78
[gh-actions]
89
python =
10+
2.7: py27
911
3.6: py36
1012
3.7: py37
1113
3.8: py38
@@ -15,6 +17,7 @@ python =
1517
[testenv]
1618
deps =
1719
-r test-requirements.txt
20+
django111: django~=1.11.0
1821
django22: django~=2.2.0
1922
django31: django~=3.1.0
2023
django32: django~=3.2.0

0 commit comments

Comments
 (0)