Skip to content

Commit 3ad4c94

Browse files
Add Django 3.2 to CI test matrix and remove 3.0 (#91)
* Add Django 3.2 to CI test matrix and remove 3.0 Also switches to v2 of the cache GitHub action, as well as specifies Django version numbers in a slightly more-readable fashion and then installs them via the "compatible release" specifier. * Update expected HTML in form validation tests * Updated classifiers Co-authored-by: David Smith <[email protected]>
1 parent 91c3547 commit 3ad4c94

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

.github/workflows/CI.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
max-parallel: 4
1515
matrix:
1616
python-version: [3.6, 3.7, 3.8, 3.9]
17-
django-version: [2.2.*, 3.0.*, 3.1.*]
17+
django-version: [2.2, 3.1, 3.2]
1818
crispy-version: [1.*]
1919

2020
steps:
@@ -24,7 +24,7 @@ jobs:
2424
with:
2525
python-version: ${{ matrix.python-version }}
2626

27-
- uses: actions/cache@v1
27+
- uses: actions/cache@v2
2828
with:
2929
path: ~/.cache/pip
3030
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
@@ -34,7 +34,7 @@ jobs:
3434
- name: Install Dependencies
3535
run: |
3636
python -m pip install --upgrade pip
37-
pip install django==${{ matrix.django-version }} django-crispy-forms==${{ matrix.crispy-version }} pytest pytest-django coverage django-coverage-plugin
37+
pip install django~=${{ matrix.django-version }}.0 django-crispy-forms==${{ matrix.crispy-version }} pytest pytest-django coverage django-coverage-plugin
3838
pip install -q -e .
3939
- name: Run Tests
4040
run: |

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
"Environment :: Web Environment",
3030
"Framework :: Django",
3131
"Framework :: Django :: 2.2",
32-
"Framework :: Django :: 3.0",
3332
"Framework :: Django :: 3.1",
33+
"Framework :: Django :: 3.2",
3434
"License :: OSI Approved :: MIT License",
3535
"Operating System :: OS Independent",
3636
"Programming Language :: JavaScript",

tests/test_helper.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import django
12
from django.forms.models import formset_factory
23
from django.template import Template
34
from django.test import SimpleTestCase
@@ -303,6 +304,8 @@ def test_formset_with_errors(self):
303304
formset.helper.formset_error_title = "Non Form Errors"
304305
formset.helper.form_tag = False
305306
formset.helper.layout = Layout("email")
307+
if django.VERSION < (3, 2):
308+
formset.non_form_errors = ["Please submit at most 2 forms."]
306309
html = render_crispy_form(formset)
307310
expected_html = """
308311
<div>
@@ -315,7 +318,7 @@ def test_formset_with_errors(self):
315318
</div>
316319
<div class="border border-red-400 rounded-b bg-red-100 px-4 py-3 text-red-700">
317320
<ul>
318-
<li>Please submit 2 or fewer forms.</li>
321+
<li>Please submit at most 2 forms.</li>
319322
</ul>
320323
</div>
321324
</div>

tests/test_table_inline_formset.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import django
12
from django.forms import formset_factory
23
from django.test import SimpleTestCase
34

@@ -217,14 +218,16 @@ def test_failing_table_inline_formset(self):
217218
formset.helper = FormHelper()
218219
formset.helper.add_input(Submit("submit", "submit"))
219220
formset.helper.template = "tailwind/table_inline_formset.html"
221+
if django.VERSION < (3, 2):
222+
formset.non_form_errors = ["Please submit at most 2 forms."]
220223
html = render_crispy_form(formset)
221224
expected_html = """
222225
<form method="post">
223226
<div> <input type="hidden" name="name-TOTAL_FORMS" value="3" id="id_name-TOTAL_FORMS"> <input type="hidden" name="name-INITIAL_FORMS" value="0" id="id_name-INITIAL_FORMS"> <input type="hidden" name="name-MIN_NUM_FORMS" value="0" id="id_name-MIN_NUM_FORMS"> <input type="hidden" name="name-MAX_NUM_FORMS" value="0" id="id_name-MAX_NUM_FORMS"> </div>
224227
<div class="alert mb-4">
225228
<div class="border border-red-400 rounded-b bg-red-100 px-4 py-3 text-red-700">
226229
<ul>
227-
<li>Please submit 2 or fewer forms.</li>
230+
<li>Please submit at most 2 forms.</li>
228231
</ul>
229232
</div>
230233
</div>

0 commit comments

Comments
 (0)