From 1902d0a34564484c8ab7cc543ec9f4d7b1eccaa3 Mon Sep 17 00:00:00 2001 From: Will Barton Date: Wed, 6 Jul 2022 11:14:03 -0400 Subject: [PATCH 1/6] Define new supported versions Declare support for Django 3.2 and 4.0, and Wagtail 2.15 to 3.0. --- README.md | 10 +++++----- setup.py | 11 ++++++----- tox.ini | 17 ++++++++--------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 9271c8b..2523f7b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Coverage Status](https://coveralls.io/repos/github/cfpb/wagtail-flags/badge.svg?branch=master)](https://coveralls.io/github/cfpb/wagtail-flags?branch=master) [![Ethical open source](https://img.shields.io/badge/open-ethical-%234baaaa)](https://ethicalsource.dev/definition/) -Feature flags allow you to toggle functionality based on configurable conditions. +Feature flags allow you to toggle functionality based on configurable conditions. Wagtail-Flags adds a Wagtail admin UI and Wagtail Site-based condition on top of [Django-Flags](https://github.com/cfpb/django-flags). For a more complete overview of feature flags and how to use them, please see the [Django-Flags documentation](https://cfpb.github.io/django-flags). @@ -23,9 +23,9 @@ Wagtail-Flags adds a Wagtail admin UI and Wagtail Site-based condition on top of ## Dependencies - Python 3.6+ -- Django 2.2 (LTS), 3.1 (current) -- Django-Flags 4.2 -- Wagtail 2.11 (LTS), <3 +- Django 3.2 (LTS), 4.0 (current) +- Django-Flags 4.2 +- Wagtail 2.15 (LTS), 3.0 It should be compatible at all intermediate versions, as well. If you find that it is not, please [file an issue](https://github.com/cfpb/wagtail-flags/issues/new). @@ -70,7 +70,7 @@ Then use the flag in a Django template (`mytemplate.html`): {% if my_flag %}
- I’m the result of a feature flag. + I’m the result of a feature flag.
{% endif %} ``` diff --git a/setup.py b/setup.py index 3c7919a..5c2af6a 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import find_packages, setup install_requires = [ - "wagtail>=2.11,<3", + "wagtail>=2.15,<4", "django-flags>=4.2,<5.1", ] @@ -16,18 +16,19 @@ long_description=open("README.md", "r", encoding="utf-8").read(), long_description_content_type="text/markdown", license="CC0", - version="5.1.0", + version="5.2.0", include_package_data=True, packages=find_packages(), - python_requires=">=3.6", + python_requires=">=3.8", install_requires=install_requires, extras_require={"testing": testing_extras}, classifiers=[ "Framework :: Django", - "Framework :: Django :: 2.2", - "Framework :: Django :: 3.1", + "Framework :: Django :: 3.2", + "Framework :: Django :: 4.0", "Framework :: Wagtail", "Framework :: Wagtail :: 2", + "Framework :: Wagtail :: 3", "License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication", "License :: Public Domain", "Programming Language :: Python", diff --git a/tox.ini b/tox.ini index f43b177..feb6029 100644 --- a/tox.ini +++ b/tox.ini @@ -2,9 +2,7 @@ skipsdist=True envlist= lint, - py{36}-dj{22}-wag{211,latest}, - py{39}-dj{22}-wag{211}, - py{39}-dj{22,32}-wag{latest} + py{39,310}-dj{32,40}-wag{215,30,latest}, [testenv] install_command=pip install -e ".[testing]" -U {opts} {packages} @@ -16,17 +14,18 @@ setenv= DJANGO_SETTINGS_MODULE=wagtailflags.tests.settings basepython= - py36: python3.6 - py39: python3.9 + py39: python3.9 + py310: python3.10 deps= - dj22: Django>=2.2,<2.3 dj32: Django>=3.2,<3.3 - wag211: wagtail>=2.11,<2.12 - waglatest: wagtail<3 + dj40: Django>=4.0,<4.1 + wag215: wagtail>=2.15,<2.16 + wag30: wagtail>=3.0,<3.1 + waglatest: wagtail<4 [testenv:lint] -basepython=python3.9 +basepython=python3.10 deps= black flake8 From a5efbc716a7f7fa50deaf292ebd51f7c35299d0f Mon Sep 17 00:00:00 2001 From: Will Barton Date: Wed, 6 Jul 2022 11:54:55 -0400 Subject: [PATCH 2/6] Support Wagtail 3.0 on Django 3.2 --- .../wagtailflags/flags/create_flag.html | 4 ++-- .../wagtailflags/flags/edit_condition.html | 4 ++-- .../wagtailflags/includes/flag_index.html | 11 +++++----- wagtailflags/tests/settings.py | 22 ++++++++++++++++--- wagtailflags/tests/test_conditions.py | 12 +++++----- wagtailflags/tests/test_signals.py | 8 ++++++- wagtailflags/tests/test_views.py | 8 ++++++- wagtailflags/wagtail_hooks.py | 16 +++++++------- 8 files changed, 57 insertions(+), 28 deletions(-) diff --git a/wagtailflags/templates/wagtailflags/flags/create_flag.html b/wagtailflags/templates/wagtailflags/flags/create_flag.html index 915c489..1b38d34 100644 --- a/wagtailflags/templates/wagtailflags/flags/create_flag.html +++ b/wagtailflags/templates/wagtailflags/flags/create_flag.html @@ -1,5 +1,5 @@ {% extends "wagtailadmin/base.html" %} -{% load i18n %} +{% load i18n wagtailadmin_tags %} {% block titletag %}Create a flag{% endblock %} {% block content %} @@ -31,7 +31,7 @@

  • - Back to flags + {% icon name="cog" wrapped=1 %} Back to flags
  • diff --git a/wagtailflags/templates/wagtailflags/flags/edit_condition.html b/wagtailflags/templates/wagtailflags/flags/edit_condition.html index d5d14dc..a9657d4 100644 --- a/wagtailflags/templates/wagtailflags/flags/edit_condition.html +++ b/wagtailflags/templates/wagtailflags/flags/edit_condition.html @@ -1,5 +1,5 @@ {% extends "wagtailadmin/base.html" %} -{% load i18n feature_flags %} +{% load i18n feature_flags wagtailadmin_tags %} {% block titletag %}{% if form.instance %}Edit {{ form.instance.condition }} condition{% else %}Create condition{% endif %}{% endblock %} {% block content %} @@ -47,7 +47,7 @@

  • - Back to {{ flag.name }} + {% icon name="cog" wrapped=1 %} Back to {{ flag.name }}
  • diff --git a/wagtailflags/templates/wagtailflags/includes/flag_index.html b/wagtailflags/templates/wagtailflags/includes/flag_index.html index 31ac7be..be8d4a5 100644 --- a/wagtailflags/templates/wagtailflags/includes/flag_index.html +++ b/wagtailflags/templates/wagtailflags/includes/flag_index.html @@ -1,13 +1,12 @@ -{% load i18n %} -{% load wagtailflags_admin %} -{% load i18n feature_flags flags_debug wagtailflags_admin %} +{% load i18n wagtailadmin_tags %} +{% load feature_flags flags_debug wagtailflags_admin %}

    {{ flag|state_str }}

    - {% with flag|conditions_without_bool as conditions %} + {% with flag|conditions_without_bool as conditions %} {% if conditions|length > 0 %} @@ -47,7 +46,7 @@ {% endwith %} {% if flag|enablable or flag|disablable %} - {% if flag|bool_enabled %}Disable{% else %}Enable{% endif %} {{ flag.name }} {% if flag|required_conditions_without_bool|length > 0 %} @@ -57,5 +56,5 @@ {% endif %} {% endif %} - Add a condition + {% icon name="plus" wrapped=1 %} Add a condition diff --git a/wagtailflags/tests/settings.py b/wagtailflags/tests/settings.py index 8733fed..b3cafd7 100644 --- a/wagtailflags/tests/settings.py +++ b/wagtailflags/tests/settings.py @@ -1,5 +1,6 @@ import os +import wagtail ALLOWED_HOSTS = ["*"] @@ -30,9 +31,7 @@ "wagtail.contrib.forms", "wagtail.contrib.modeladmin", "wagtail.contrib.settings", - "wagtail.tests.testapp", "wagtail.admin", - "wagtail.core", "wagtail.documents", "wagtail.images", "wagtail.sites", @@ -41,9 +40,26 @@ WAGTAILADMIN_RICH_TEXT_EDITORS = { "default": {"WIDGET": "wagtail.admin.rich_text.DraftailRichTextArea"}, - "custom": {"WIDGET": "wagtail.tests.testapp.rich_text.CustomRichTextArea"}, } +# Wagtail 3.0 moves testapp from wagtail.tests to wagtail.test +if wagtail.VERSION >= (3, 0, 0): # pragma: no cover + WAGTAIL_APPS += ( + "wagtail", + "wagtail.test.testapp", + ) + WAGTAILADMIN_RICH_TEXT_EDITORS["custom"] = { + "WIDGET": "wagtail.test.testapp.rich_text.CustomRichTextArea" + } +else: # pragma: no cover + WAGTAIL_APPS += ( + "wagtail.core", + "wagtail.tests.testapp", + ) + WAGTAILADMIN_RICH_TEXT_EDITORS["custom"] = { + "WIDGET": "wagtail.tests.testapp.rich_text.CustomRichTextArea" + } + MIDDLEWARE = ( "django.middleware.common.CommonMiddleware", "django.contrib.sessions.middleware.SessionMiddleware", diff --git a/wagtailflags/tests/test_conditions.py b/wagtailflags/tests/test_conditions.py index 1a8ac07..1fd0b18 100644 --- a/wagtailflags/tests/test_conditions.py +++ b/wagtailflags/tests/test_conditions.py @@ -1,22 +1,24 @@ from django.test import RequestFactory, TestCase import wagtail -from wagtail.core.models import Site from flags.conditions import RequiredForCondition from wagtailflags.conditions import site_condition +if wagtail.VERSION > (3, 0, 0): # pragma: no cover + from wagtail.models import Site +else: # pragma: no cover + from wagtail.core.models import Site + + class SiteConditionTestCase(TestCase): def setUp(self): self.site = Site.objects.get(is_default_site=True) self.factory = RequestFactory() self.request = self.factory.get("/") - if wagtail.VERSION >= (2, 9): # pragma: no cover - Site.find_for_request(self.request) - else: # pragma: no cover - self.request.site = self.site + Site.find_for_request(self.request) def test_site_valid_string(self): self.assertTrue(site_condition("localhost:80", request=self.request)) diff --git a/wagtailflags/tests/test_signals.py b/wagtailflags/tests/test_signals.py index 09e451b..8e30acb 100644 --- a/wagtailflags/tests/test_signals.py +++ b/wagtailflags/tests/test_signals.py @@ -2,13 +2,19 @@ from django.test import TestCase -from wagtail.tests.utils import WagtailTestUtils +import wagtail from flags.models import FlagState from wagtailflags.signals import flag_disabled, flag_enabled +if wagtail.VERSION >= (3, 0, 0): # pragma: no cover + from wagtail.test.utils import WagtailTestUtils +else: # pragma: no cover + from wagtail.tests.utils import WagtailTestUtils + + class SignalsTestCase(TestCase, WagtailTestUtils): def setUp(self): self.login() diff --git a/wagtailflags/tests/test_views.py b/wagtailflags/tests/test_views.py index 3f4328f..ecb04de 100644 --- a/wagtailflags/tests/test_views.py +++ b/wagtailflags/tests/test_views.py @@ -1,10 +1,16 @@ from django.test import TestCase -from wagtail.tests.utils import WagtailTestUtils +import wagtail from flags.models import FlagState +if wagtail.VERSION >= (3, 0, 0): # pragma: no cover + from wagtail.test.utils import WagtailTestUtils +else: # pragma: no cover + from wagtail.tests.utils import WagtailTestUtils + + class TestWagtailFlagsViews(TestCase, WagtailTestUtils): def setUp(self): self.login() diff --git a/wagtailflags/wagtail_hooks.py b/wagtailflags/wagtail_hooks.py index 65133a0..4884620 100644 --- a/wagtailflags/wagtail_hooks.py +++ b/wagtailflags/wagtail_hooks.py @@ -2,18 +2,18 @@ from django.templatetags.static import static from django.utils.html import format_html +import wagtail from wagtail.admin.menu import MenuItem -from wagtail.core import hooks from wagtailflags import views -try: # pragma: no cover; >= 2.0 - from django.urls import include, re_path, reverse -except ImportError: # pragma: no cover; fallback for Django < 2.0 - from django.conf.urls import include - from django.conf.urls import url as re_path - from django.core.urlresolvers import reverse +if wagtail.VERSION >= (3, 0, 0): # pragma: no cover + from wagtail import hooks +else: # pragma: no cover + from wagtail.core import hooks + +from django.urls import include, re_path, reverse @hooks.register("register_settings_menu_item") @@ -21,7 +21,7 @@ def register_flags_menu(): return MenuItem( "Flags", reverse("wagtailflags:list"), - classnames="icon icon-tag", + icon_name="tag", order=10000, ) From 787c3975ebdb83fa6f8553327e052cec2717dd60 Mon Sep 17 00:00:00 2001 From: Will Barton Date: Wed, 6 Jul 2022 12:33:33 -0400 Subject: [PATCH 3/6] Improve Django 4.0 compatibility This change removes the deprecated `providing_args` argument from Signal(), and removes default_app_config, and adds an explicit USE_TZ=True. --- wagtailflags/__init__.py | 1 - wagtailflags/signals.py | 4 ++-- wagtailflags/tests/settings.py | 1 + 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wagtailflags/__init__.py b/wagtailflags/__init__.py index ea48640..e69de29 100644 --- a/wagtailflags/__init__.py +++ b/wagtailflags/__init__.py @@ -1 +0,0 @@ -default_app_config = "wagtailflags.apps.WagtailFlagsAppConfig" diff --git a/wagtailflags/signals.py b/wagtailflags/signals.py index 1a81ff0..f81a972 100644 --- a/wagtailflags/signals.py +++ b/wagtailflags/signals.py @@ -1,5 +1,5 @@ from django.dispatch import Signal -flag_disabled = Signal(providing_args=["instance", "flag_name"]) -flag_enabled = Signal(providing_args=["instance", "flag_name"]) +flag_disabled = Signal() +flag_enabled = Signal() diff --git a/wagtailflags/tests/settings.py b/wagtailflags/tests/settings.py index b3cafd7..a4e185f 100644 --- a/wagtailflags/tests/settings.py +++ b/wagtailflags/tests/settings.py @@ -4,6 +4,7 @@ ALLOWED_HOSTS = ["*"] +USE_TZ = True SECRET_KEY = "not needed" ROOT_URLCONF = "wagtailflags.tests.urls" From cf1c22ab6a545a98c708cdeea49998aff5dbc588 Mon Sep 17 00:00:00 2001 From: Will Barton Date: Wed, 6 Jul 2022 17:08:10 -0400 Subject: [PATCH 4/6] Adopt setup.cfg in place of setup.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We don’t do anything other than set options in our existing setup.py, which is the purpose of setup.cfg. This change moves those to setup.cfg and removes those from setup.py. It also moves our flake8 and isort config to setup.cfg. --- .gitignore | 2 +- pyproject.toml | 23 ++++----------- setup.cfg | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++ setup.py | 39 ++------------------------ tox.ini | 41 ++++++++++----------------- 5 files changed, 100 insertions(+), 81 deletions(-) create mode 100644 setup.cfg diff --git a/.gitignore b/.gitignore index ca2b58b..9f36985 100644 --- a/.gitignore +++ b/.gitignore @@ -58,7 +58,7 @@ __pycache__/ ################# htmlcov/ .tox/ -.coverage +.coverage* .cache nosetests.xml coverage.xml diff --git a/pyproject.toml b/pyproject.toml index 2d6007c..d237113 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,22 +20,9 @@ exclude = ''' ) ''' -[tool.isort] -profile = "black" -line_length = 79 -lines_after_imports = 2 -skip = [".tox", "migrations", ".venv", "venv"] -known_django = ["django"] -known_wagtail = ["wagtail"] -default_section = "THIRDPARTY" -sections = [ - "STDLIB", - "DJANGO", - "WAGTAIL", - "THIRDPARTY", - "FIRSTPARTY", - "LOCALFOLDER" -] - [build-system] -requires = ["setuptools", "wheel"] +requires = [ + "setuptools>=42", + "wheel" +] +build-backend = "setuptools.build_meta" diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..b2edf83 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,76 @@ +[metadata] +name = wagtail-flags +version = 5.2.0 +author = CFPB +author_email = tech@cfpb.gov +description = Feature flags for Wagtail sites +long_description = file: README.md +long_description_content_type = text/markdown +license = CC0 +url = https://github.com/cfpb/wagtail-flags +classifiers = + Operating System :: OS Independent + Framework :: Django + Framework :: Django :: 3.2 + Framework :: Django :: 4.0 + Framework :: Wagtail + Framework :: Wagtail :: 2 + Framework :: Wagtail :: 3 + License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication + License :: Public Domain + Programming Language :: Python + Programming Language :: Python :: 3 + +[options] +include_package_data = True +packages = find: +python_requires = >=3.8 +zip_safe = False +install_requires = + wagtail>=2.15,<4 + django-flags>=4.2,<5.1 + +[options.extras_require] +testing = + coverage + +[flake8] +ignore = E731,W503,W504 +exclude = + .git, + .tox, + __pycache__, + */migrations/*.py, + .eggs/*, + +[isort] +profile = black +combine_as_imports = 1 +lines_after_imports = 2 +include_trailing_comma = 1 +multi_line_output = 3 +skip = .tox,migrations +known_django = django +known_wagtail = wagtail +default_section = THIRDPARTY +sections = FUTURE,STDLIB,DJANGO,WAGTAIL,THIRDPARTY,FIRSTPARTY,LOCALFOLDER + +[mypy] +allow_redefinition = false +check_untyped_defs = true +disallow_untyped_decorators = true +disallow_any_explicit = true +disallow_any_generics = true +disallow_untyped_calls = true +ignore_errors = false +ignore_missing_imports = true +implicit_reexport = false +local_partial_types = true +strict_optional = true +strict_equality = true +no_implicit_optional = true +warn_unused_ignores = true +warn_redundant_casts = true +warn_unused_configs = true +warn_unreachable = true +warn_no_return = true diff --git a/setup.py b/setup.py index 5c2af6a..6b40b52 100644 --- a/setup.py +++ b/setup.py @@ -1,37 +1,4 @@ -from setuptools import find_packages, setup +from setuptools import setup -install_requires = [ - "wagtail>=2.15,<4", - "django-flags>=4.2,<5.1", -] - -testing_extras = ["coverage>=3.7.0"] - -setup( - name="wagtail-flags", - url="https://github.com/cfpb/wagtail-flags", - author="CFPB", - author_email="tech@cfpb.gov", - description="Feature flags for Wagtail sites", - long_description=open("README.md", "r", encoding="utf-8").read(), - long_description_content_type="text/markdown", - license="CC0", - version="5.2.0", - include_package_data=True, - packages=find_packages(), - python_requires=">=3.8", - install_requires=install_requires, - extras_require={"testing": testing_extras}, - classifiers=[ - "Framework :: Django", - "Framework :: Django :: 3.2", - "Framework :: Django :: 4.0", - "Framework :: Wagtail", - "Framework :: Wagtail :: 2", - "Framework :: Wagtail :: 3", - "License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication", - "License :: Public Domain", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - ], -) +if __name__ == '__main__': + setup() diff --git a/tox.ini b/tox.ini index feb6029..3823476 100644 --- a/tox.ini +++ b/tox.ini @@ -2,14 +2,14 @@ skipsdist=True envlist= lint, - py{39,310}-dj{32,40}-wag{215,30,latest}, + py{39,310}-dj{32}-wag{215}, + py{39,310}-dj{32,40}-wag{30,latest}, + coverage [testenv] install_command=pip install -e ".[testing]" -U {opts} {packages} commands= - coverage erase - coverage run --source='wagtailflags' {envbindir}/django-admin.py test {posargs} - coverage report -m + python -b -m coverage run --parallel-mode --source='wagtailflags' {envbindir}/django-admin test {posargs} setenv= DJANGO_SETTINGS_MODULE=wagtailflags.tests.settings @@ -31,27 +31,16 @@ deps= flake8 isort commands= - black --check wagtailflags setup.py - flake8 wagtailflags setup.py + black --check wagtailflags + flake8 wagtailflags isort --check-only --diff wagtailflags -[flake8] -ignore=E731,W503,W504 -exclude= - .git, - .tox, - __pycache__, - */migrations/*.py, - .eggs/*, - -[isort] -combine_as_imports=1 -lines_after_imports=2 -include_trailing_comma=1 -multi_line_output=3 -skip=.tox,migrations -use_parentheses=1 -known_django=django -known_wagtail=wagtail -default_section=THIRDPARTY -sections=FUTURE,STDLIB,DJANGO,WAGTAIL,THIRDPARTY,FIRSTPARTY,LOCALFOLDER +[testenv:coverage] +basepython=python3.9 +deps= + coverage + diff_cover +commands= + coverage combine + coverage xml + diff-cover coverage.xml --compare-branch=origin/main --fail-under=100 From e8914ae5d96f6bab51f626f2bd4cdd1ed3c11a91 Mon Sep 17 00:00:00 2001 From: Will Barton Date: Thu, 7 Jul 2022 09:27:43 -0400 Subject: [PATCH 5/6] Update our GitHub Actions test matrix --- .github/workflows/test.yml | 79 ++++++++++++++++++++++++++------------ tox.ini | 2 +- 2 files changed, 56 insertions(+), 25 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f07c9c5..d4b923d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,12 +8,12 @@ jobs: name: lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: "3.10" - name: Install dependencies run: | @@ -32,30 +32,29 @@ jobs: strategy: matrix: toxenv: - - py36-dj22-wag211 - - py36-dj22-waglatest - - py39-dj22-wag211 - - py39-dj22-waglatest - - py39-dj32-waglatest + # Legacy versions + - py39-dj32-wag215 + + # Current and latest versions + - py310-dj32-wag30 + - py310-dj40-wag30 + - py310-dj40-waglatest + include: - - toxenv: py36-dj22-wag211 - python-version: 3.6 - - toxenv: py36-dj22-waglatest - python-version: 3.6 - - toxenv: py39-dj22-waglatest - python-version: 3.9 - - toxenv: py39-dj22-wag211 - python-version: 3.9 - - toxenv: py39-dj22-waglatest - python-version: 3.9 - - toxenv: py39-dj32-waglatest - python-version: 3.9 + - toxenv: py39-dj32-wag215 + python-version: "3.9" + - toxenv: py310-dj32-wag30 + python-version: "3.10" + - toxenv: py310-dj40-wag30 + python-version: "3.10" + - toxenv: py310-dj40-waglatest + python-version: "3.10" steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} @@ -67,7 +66,39 @@ jobs: - name: Run tox run: | tox - coveralls env: TOXENV: ${{ matrix.toxenv }} - COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + + - name: Store test coverage + uses: actions/upload-artifact@v2 + with: + name: coverage + path: .coverage.* + + coverage: + name: coverage + runs-on: ubuntu-latest + needs: + - test + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install tox + - name: Retrieve test coverage + uses: actions/download-artifact@v2 + with: + name: coverage + + - name: Check coverage + run: tox -e coverage diff --git a/tox.ini b/tox.ini index 3823476..0bc1cb8 100644 --- a/tox.ini +++ b/tox.ini @@ -36,7 +36,7 @@ commands= isort --check-only --diff wagtailflags [testenv:coverage] -basepython=python3.9 +basepython=python3.10 deps= coverage diff_cover From 40c7806dcef42029e04bf8977db2f1703d8dc87d Mon Sep 17 00:00:00 2001 From: Will Barton Date: Thu, 7 Jul 2022 09:59:05 -0400 Subject: [PATCH 6/6] Fix import sorting --- wagtailflags/tests/settings.py | 1 + wagtailflags/tests/urls.py | 9 ++------- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/wagtailflags/tests/settings.py b/wagtailflags/tests/settings.py index a4e185f..5b9843b 100644 --- a/wagtailflags/tests/settings.py +++ b/wagtailflags/tests/settings.py @@ -2,6 +2,7 @@ import wagtail + ALLOWED_HOSTS = ["*"] USE_TZ = True diff --git a/wagtailflags/tests/urls.py b/wagtailflags/tests/urls.py index 7f8e99b..c25c71a 100644 --- a/wagtailflags/tests/urls.py +++ b/wagtailflags/tests/urls.py @@ -1,11 +1,6 @@ -from wagtail.admin import urls as wagtailadmin_urls - +from django.urls import include, re_path -try: # pragma: no cover; >= 2.0 - from django.urls import include, re_path -except ImportError: # pragma: no cover; fallback for Django < 2.0 - from django.conf.urls import include - from django.conf.urls import url as re_path +from wagtail.admin import urls as wagtailadmin_urls urlpatterns = [