Skip to content

Commit cfbd078

Browse files
RyAuldCopilot
andcommitted
Address Copilot review: benchmark skip, pytest install, artifact guard
- Add --benchmark-skip to CI pytest runs so benchmarks only run in the dedicated Benchmark stage, not on every PR across all Python versions - Explicitly install pytest in the Benchmark job instead of relying on transitive dependency from pytest-benchmark - Guard PublishPipelineArtifact with a file existence check so a missing benchmark.json does not mask the underlying failure Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 358e010 commit cfbd078

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

.Pipelines/template-pipeline-stages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ stages:
197197
pip install pytest pytest-azurepipelines
198198
mkdir -p test-results
199199
set -o pipefail
200-
pytest -vv --junitxml=test-results/junit.xml --deselect tests/test_cryptography.py::CryptographyTestCase::test_ceiling_should_be_latest_cryptography_version_plus_three --deselect tests/test_cryptography.py::CryptographyTestCase::test_should_be_run_with_latest_version_of_cryptography 2>&1 | tee test-results/pytest.log
200+
pytest -vv --benchmark-skip --junitxml=test-results/junit.xml --deselect tests/test_cryptography.py::CryptographyTestCase::test_ceiling_should_be_latest_cryptography_version_plus_three --deselect tests/test_cryptography.py::CryptographyTestCase::test_should_be_run_with_latest_version_of_cryptography 2>&1 | tee test-results/pytest.log
201201
displayName: 'Run tests'
202202
retryCountOnTaskFailure: 3
203203
env:

azure-pipelines.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ stages:
5353

5454
- script: |
5555
python -m pip install --upgrade pip
56-
pip install -r requirements.txt
56+
pip install pytest -r requirements.txt
5757
displayName: 'Install dependencies'
5858
5959
- task: Cache@2
@@ -66,9 +66,14 @@ stages:
6666
pytest --benchmark-only --benchmark-json benchmark.json --log-cli-level INFO tests/test_benchmark.py
6767
displayName: 'Run benchmarks'
6868
69+
- bash: |
70+
[ -f benchmark.json ] && echo "##vso[task.setvariable variable=benchmarkFileExists]true"
71+
displayName: 'Check benchmark output exists'
72+
condition: succeededOrFailed()
73+
6974
- task: PublishPipelineArtifact@1
7075
displayName: 'Publish benchmark results'
71-
condition: succeededOrFailed()
76+
condition: and(succeededOrFailed(), eq(variables['benchmarkFileExists'], 'true'))
7277
inputs:
7378
targetPath: 'benchmark.json'
7479
artifact: 'benchmark-results'

0 commit comments

Comments
 (0)