From 3ad4c94ebf0fab7ef73b2fa970bd0a4b63d0a3f1 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Tue, 13 Apr 2021 09:27:49 +0200 Subject: [PATCH] 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 --- .github/workflows/CI.yml | 6 +++--- setup.py | 2 +- tests/test_helper.py | 5 ++++- tests/test_table_inline_formset.py | 5 ++++- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 1049f72..10bae91 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -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: @@ -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') }} @@ -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: | diff --git a/setup.py b/setup.py index 8134b71..89137ee 100644 --- a/setup.py +++ b/setup.py @@ -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", diff --git a/tests/test_helper.py b/tests/test_helper.py index b141bb1..addd9ca 100644 --- a/tests/test_helper.py +++ b/tests/test_helper.py @@ -1,3 +1,4 @@ +import django from django.forms.models import formset_factory from django.template import Template from django.test import SimpleTestCase @@ -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 = """
@@ -315,7 +318,7 @@ def test_formset_with_errors(self):
    -
  • Please submit 2 or fewer forms.
  • +
  • Please submit at most 2 forms.
diff --git a/tests/test_table_inline_formset.py b/tests/test_table_inline_formset.py index 517f4f9..9968dcc 100644 --- a/tests/test_table_inline_formset.py +++ b/tests/test_table_inline_formset.py @@ -1,3 +1,4 @@ +import django from django.forms import formset_factory from django.test import SimpleTestCase @@ -217,6 +218,8 @@ 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 = """
@@ -224,7 +227,7 @@ def test_failing_table_inline_formset(self):
    -
  • Please submit 2 or fewer forms.
  • +
  • Please submit at most 2 forms.