Skip to content

Commit a5ea746

Browse files
authored
skip tests on 3.10 - 3.12 if version is 2.x (#321)
1 parent cc12412 commit a5ea746

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

eng/templates/jobs/ci-tests.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,31 @@ jobs:
2020
inputs:
2121
versionSpec: $(PYTHON_VERSION)
2222
- bash: |
23+
VERSION=$(python -c "import re; content = open('azure/functions/__init__.py').read(); match = re.search(r\"__version__ = '(\d+)\.(\d+)\.(\d+).*'\", content); print(match.group(1)) if match else '1'")
24+
echo "##vso[task.setvariable variable=MAJOR_VERSION]$VERSION"
25+
displayName: 'Detect package version'
26+
- bash: |
27+
PYTHON_MAJOR=$(echo $(PYTHON_VERSION) | cut -d. -f1)
28+
PYTHON_MINOR=$(echo $(PYTHON_VERSION) | cut -d. -f2)
29+
30+
if [ "$MAJOR_VERSION" == "2" ] && [ "$PYTHON_MINOR" -lt "13" ]; then
31+
echo "Skipping tests for Python $PYTHON_VERSION on package version 2.x (requires Python 3.13+)"
32+
exit 0
33+
fi
34+
2335
python -m pip install --upgrade pip
2436
python -m pip install -U -e .[dev]
2537
displayName: 'Install dependencies'
38+
condition: succeededOrFailed()
2639
- bash: |
40+
PYTHON_MAJOR=$(echo $(PYTHON_VERSION) | cut -d. -f1)
41+
PYTHON_MINOR=$(echo $(PYTHON_VERSION) | cut -d. -f2)
42+
43+
if [ "$MAJOR_VERSION" == "2" ] && [ "$PYTHON_MINOR" -lt "13" ]; then
44+
echo "Skipping tests for Python $PYTHON_VERSION on package version 2.x (requires Python 3.13+)"
45+
exit 0
46+
fi
47+
2748
python -m pytest --cache-clear --cov=./azure --cov-report=xml --cov-branch tests
28-
displayName: 'Test with pytest'
49+
displayName: 'Test with pytest'
50+
condition: succeededOrFailed()

0 commit comments

Comments
 (0)