Skip to content

Commit

Permalink
Add Django 3.2 to CI test matrix and remove 3.0 (#91)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
justinmayer and smithdc1 authored Apr 13, 2021
1 parent 91c3547 commit 3ad4c94
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
max-parallel: 4
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
django-version: [2.2.*, 3.0.*, 3.1.*]
django-version: [2.2, 3.1, 3.2]
crispy-version: [1.*]

steps:
Expand All @@ -24,7 +24,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- uses: actions/cache@v1
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
Expand All @@ -34,7 +34,7 @@ jobs:
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install django==${{ matrix.django-version }} django-crispy-forms==${{ matrix.crispy-version }} pytest pytest-django coverage django-coverage-plugin
pip install django~=${{ matrix.django-version }}.0 django-crispy-forms==${{ matrix.crispy-version }} pytest pytest-django coverage django-coverage-plugin
pip install -q -e .
- name: Run Tests
run: |
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"Environment :: Web Environment",
"Framework :: Django",
"Framework :: Django :: 2.2",
"Framework :: Django :: 3.0",
"Framework :: Django :: 3.1",
"Framework :: Django :: 3.2",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: JavaScript",
Expand Down
5 changes: 4 additions & 1 deletion tests/test_helper.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import django
from django.forms.models import formset_factory
from django.template import Template
from django.test import SimpleTestCase
Expand Down Expand Up @@ -303,6 +304,8 @@ def test_formset_with_errors(self):
formset.helper.formset_error_title = "Non Form Errors"
formset.helper.form_tag = False
formset.helper.layout = Layout("email")
if django.VERSION < (3, 2):
formset.non_form_errors = ["Please submit at most 2 forms."]
html = render_crispy_form(formset)
expected_html = """
<div>
Expand All @@ -315,7 +318,7 @@ def test_formset_with_errors(self):
</div>
<div class="border border-red-400 rounded-b bg-red-100 px-4 py-3 text-red-700">
<ul>
<li>Please submit 2 or fewer forms.</li>
<li>Please submit at most 2 forms.</li>
</ul>
</div>
</div>
Expand Down
5 changes: 4 additions & 1 deletion tests/test_table_inline_formset.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import django
from django.forms import formset_factory
from django.test import SimpleTestCase

Expand Down Expand Up @@ -217,14 +218,16 @@ def test_failing_table_inline_formset(self):
formset.helper = FormHelper()
formset.helper.add_input(Submit("submit", "submit"))
formset.helper.template = "tailwind/table_inline_formset.html"
if django.VERSION < (3, 2):
formset.non_form_errors = ["Please submit at most 2 forms."]
html = render_crispy_form(formset)
expected_html = """
<form method="post">
<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>
<div class="alert mb-4">
<div class="border border-red-400 rounded-b bg-red-100 px-4 py-3 text-red-700">
<ul>
<li>Please submit 2 or fewer forms.</li>
<li>Please submit at most 2 forms.</li>
</ul>
</div>
</div>
Expand Down

0 comments on commit 3ad4c94

Please sign in to comment.