diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ab1da3c..947f642 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,8 +13,8 @@ jobs: name: tests strategy: matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - python: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] + os: [ubuntu-latest, macos-latest] # TODO: add windows-latest + python: ['3.8', '3.9', '3.10', '3.11', '3.12'] fail-fast: false runs-on: ${{ matrix.os }} steps: diff --git a/src/flask_assets.py b/src/flask_assets.py index c4232b2..4bfec70 100644 --- a/src/flask_assets.py +++ b/src/flask_assets.py @@ -5,7 +5,12 @@ import logging from os import path -from flask.globals import request_ctx, app_ctx +try: + from flask.globals import request_ctx, app_ctx +except ImportError: + from flask import _request_ctx_stack, _app_ctx_stack + request_ctx = _request_ctx_stack.top + app_ctx = _app_ctx_stack.top from flask import current_app, has_app_context, has_request_context from flask.templating import render_template_string # We want to expose Bundle via this module. diff --git a/tox.ini b/tox.ini index 75b9c6c..102dee1 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py37, py38, py39, py310, py311, py312 +envlist = py37, py38, py39, py310, py311, py312, flask1, flask2 skip_missing_interpreters = true [gh-actions] @@ -10,9 +10,25 @@ python = 3.10: py310 3.11: py311 3.12: py312 + flask1: py38 + flask2: py310 [testenv] deps = -r requirements.txt commands = pytest + +[flask1] +deps = + -r requirements.txt + flask==1.0.0 +commands = + pytest + +[flask2] +deps = + -r requirements.txt + flask==2.0.0 +commands = + pytest