Skip to content

Commit

Permalink
Fix starlette testing matrix for updated behavior. (#869)
Browse files Browse the repository at this point in the history
Co-authored-by: Lalleh Rafeei <lrafeei@users.noreply.github.com>
Co-authored-by: Hannah Stepanek <hmstepanek@users.noreply.github.com>
Co-authored-by: Uma Annamalai <umaannamalai@users.noreply.github.com>
  • Loading branch information
4 people authored Jul 14, 2023
1 parent 6644846 commit ee92363
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
17 changes: 13 additions & 4 deletions tests/framework_starlette/test_bg_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ee92363

Please sign in to comment.