From ee92363cd093cebdac26c13fd180944c41fda445 Mon Sep 17 00:00:00 2001 From: Timothy Pansino <11214426+TimPansino@users.noreply.github.com> Date: Thu, 13 Jul 2023 17:09:14 -0700 Subject: [PATCH] Fix starlette testing matrix for updated behavior. (#869) Co-authored-by: Lalleh Rafeei Co-authored-by: Hannah Stepanek Co-authored-by: Uma Annamalai --- tests/framework_starlette/test_bg_tasks.py | 17 +++++++++++++---- tox.ini | 3 ++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/tests/framework_starlette/test_bg_tasks.py b/tests/framework_starlette/test_bg_tasks.py index 07a70131b..5e30fe32e 100644 --- a/tests/framework_starlette/test_bg_tasks.py +++ b/tests/framework_starlette/test_bg_tasks.py @@ -89,11 +89,20 @@ def _test(): # The bug was fixed in version 0.21.0 but re-occured in 0.23.1. # The bug was also not present on 0.20.1 to 0.23.1 if using Python3.7. - BUG_COMPLETELY_FIXED = (0, 21, 0) <= starlette_version < (0, 23, 1) or ( - (0, 20, 1) <= starlette_version < (0, 23, 1) and sys.version_info[:2] > (3, 7) + # The bug was fixed again in version 0.29.0 + BUG_COMPLETELY_FIXED = any( + ( + (0, 21, 0) <= starlette_version < (0, 23, 1), + (0, 20, 1) <= starlette_version < (0, 23, 1) and sys.version_info[:2] > (3, 7), + starlette_version >= (0, 29, 0), + ) + ) + BUG_PARTIALLY_FIXED = any( + ( + (0, 20, 1) <= starlette_version < (0, 21, 0), + (0, 23, 1) <= starlette_version < (0, 29, 0), + ) ) - BUG_PARTIALLY_FIXED = (0, 20, 1) <= starlette_version < (0, 21, 0) or starlette_version >= (0, 23, 1) - if BUG_COMPLETELY_FIXED: # Assert both web transaction and background task transactions are present. _test = validate_transaction_metrics( diff --git a/tox.ini b/tox.ini index 32ab90995..989c0334e 100644 --- a/tox.ini +++ b/tox.ini @@ -149,7 +149,7 @@ envlist = python-framework_pyramid-{py37,py38,py39,py310,py311,pypy38}-Pyramidlatest, python-framework_sanic-{py38,pypy38}-sanic{190301,1906,1912,200904,210300,2109,2112,2203,2290}, python-framework_sanic-{py37,py38,py39,py310,py311,pypy38}-saniclatest, - python-framework_starlette-{py310,pypy38}-starlette{0014,0015,0019}, + python-framework_starlette-{py310,pypy38}-starlette{0014,0015,0019,0028}, python-framework_starlette-{py37,py38}-starlette{002001}, python-framework_starlette-{py37,py38,py39,py310,py311,pypy38}-starlettelatest, python-framework_strawberry-{py37,py38,py39,py310,py311}-strawberrylatest, @@ -359,6 +359,7 @@ deps = framework_starlette-starlette0015: starlette<0.16 framework_starlette-starlette0019: starlette<0.20 framework_starlette-starlette002001: starlette==0.20.1 + framework_starlette-starlette0028: starlette<0.29 framework_starlette-starlettelatest: starlette framework_strawberry: starlette framework_strawberry-strawberrylatest: strawberry-graphql