]> git.ipfire.org Git - thirdparty/starlette.git/commitdiff
tests: add `--branch` to coverage run (#2825)
authorMarcelo Trylesinski <marcelotryle@gmail.com>
Sat, 28 Dec 2024 20:29:57 +0000 (21:29 +0100)
committerGitHub <noreply@github.com>
Sat, 28 Dec 2024 20:29:57 +0000 (21:29 +0100)
scripts/test

index 720a66392d6260c8535a6e5908f4c0d09412de79..17dd9fb69d1bb36524ad1e4a2debf173f37cb06d 100755 (executable)
@@ -11,7 +11,10 @@ if [ -z $GITHUB_ACTIONS ]; then
     scripts/check
 fi
 
-${PREFIX}coverage run -m pytest $@
+# TODO: Remove this custom logic, and add `branch = true` to the `[coverage.run]` when we drop support for Python 3.9.
+# See https://github.com/encode/starlette/issues/2452.
+branch_option=$(python -c 'import sys; print("--branch" if sys.version_info >= (3, 10) else "")')
+${PREFIX}coverage run $branch_option -m pytest $@
 
 if [ -z $GITHUB_ACTIONS ]; then
     scripts/coverage