Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update interface-unit-tests.yml pytest warning level handling #6880

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
90 changes: 52 additions & 38 deletions .github/workflows/interface-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
default_runner: ubuntu-latest
force_large_runner: ${{ inputs.use_large_runner }}

disable-fail-fast-wae:
warnings-as-errors-setup:
needs:
- determine_runner

Expand All @@ -100,8 +100,22 @@ jobs:
run: |
echo "fail_fast=${{ contains(inputs.python_warning_level, 'default') && 'default' || 'error' }}" >> $GITHUB_OUTPUT

- name: Set pytest arguments for setting warnings level
id: pytest_warning_flags
env:
PYTEST_WARNING_ARGS: -W "${{ inputs.python_warning_level }}" --continue-on-collection-errors
run: |
if [ "${{ inputs.python_warning_level }}" != "default" ]; then
echo "Setting pytest warning flags"
echo "pytest_warning_args=$PYTEST_WARNING_ARGS" >> $GITHUB_OUTPUT
else
echo "No pytest warning flags needed"
echo "pytest_warning_args=" >> $GITHUB_OUTPUT
fi

outputs:
fail_fast: ${{ steps.mat_fail_fast.outputs.fail_fast }}
pytest_warning_args: ${{ steps.pytest_warning_flags.outputs.pytest_warning_args }}

setup-ci-load:
needs:
Expand All @@ -127,7 +141,7 @@ jobs:
then
cat >python_versions.json <<-EOF
{
"default": ["3.10"]
"default": ["3.10"]
}
EOF
else
Expand Down Expand Up @@ -215,9 +229,9 @@ jobs:
- setup-ci-load
- determine_runner
- default-dependency-versions
- disable-fail-fast-wae
- warnings-as-errors-setup
strategy:
fail-fast: ${{ needs.disable-fail-fast-wae.outputs.fail_fast == 'default' }}
fail-fast: ${{ needs.warnings-as-errors-setup.outputs.fail_fast == 'default' }}
max-parallel: >-
${{
fromJSON(needs.setup-ci-load.outputs.matrix-max-parallel).torch-tests
Expand All @@ -241,7 +255,7 @@ jobs:
${{ needs.default-dependency-versions.outputs.pytorch-version }}
${{ inputs.additional_python_packages }}
additional_pip_packages_post: ${{ needs.default-dependency-versions.outputs.pennylane-lightning-latest }}
pytest_additional_args: -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
pytest_additional_args: ${{ needs.warnings-as-errors-setup.outputs.pytest_warning_args }}
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
pytest_markers: torch and not qcut and not finite-diff and not param-shift
requirements_file: ${{ github.event_name == 'schedule' && strategy.job-index == 0 && 'torch.txt' || '' }}
Expand All @@ -252,9 +266,9 @@ jobs:
- setup-ci-load
- determine_runner
- default-dependency-versions
- disable-fail-fast-wae
- warnings-as-errors-setup
strategy:
fail-fast: ${{ needs.disable-fail-fast-wae.outputs.fail_fast == 'default' }}
fail-fast: ${{ needs.warnings-as-errors-setup.outputs.fail_fast == 'default' }}
max-parallel: >-
${{
fromJSON(needs.setup-ci-load.outputs.matrix-max-parallel).autograd-tests
Expand All @@ -277,7 +291,7 @@ jobs:
additional_pip_packages: ${{ inputs.additional_python_packages }}
additional_pip_packages_post: ${{ needs.default-dependency-versions.outputs.pennylane-lightning-latest }}
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
pytest_additional_args: -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
pytest_additional_args: ${{ needs.warnings-as-errors-setup.outputs.pytest_warning_args }}
pytest_markers: autograd and not qcut and not finite-diff and not param-shift


Expand All @@ -286,9 +300,9 @@ jobs:
- setup-ci-load
- determine_runner
- default-dependency-versions
- disable-fail-fast-wae
- warnings-as-errors-setup
strategy:
fail-fast: ${{ needs.disable-fail-fast-wae.outputs.fail_fast == 'default' }}
fail-fast: ${{ needs.warnings-as-errors-setup.outputs.fail_fast == 'default' }}
max-parallel: >-
${{
fromJSON(needs.setup-ci-load.outputs.matrix-max-parallel).tf-tests
Expand All @@ -315,7 +329,7 @@ jobs:
additional_pip_packages_post: ${{ needs.default-dependency-versions.outputs.pennylane-lightning-latest }}
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
pytest_markers: tf and not qcut and not finite-diff and not param-shift
pytest_additional_args: --splits 3 --group ${{ matrix.group }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
pytest_additional_args: --splits 3 --group ${{ matrix.group }} ${{ needs.warnings-as-errors-setup.outputs.pytest_warning_args }}
pytest_durations_file_path: '.github/durations/tf_tests_durations.json'
requirements_file: ${{ github.event_name == 'schedule' && strategy.job-index == 0 && 'tf.txt' || '' }}

Expand All @@ -324,9 +338,9 @@ jobs:
- setup-ci-load
- determine_runner
- default-dependency-versions
- disable-fail-fast-wae
- warnings-as-errors-setup
strategy:
fail-fast: ${{ needs.disable-fail-fast-wae.outputs.fail_fast == 'default' }}
fail-fast: ${{ needs.warnings-as-errors-setup.outputs.fail_fast == 'default' }}
max-parallel: >-
${{
fromJSON(needs.setup-ci-load.outputs.matrix-max-parallel).jax-tests
Expand All @@ -353,7 +367,7 @@ jobs:
additional_pip_packages_post: ${{ needs.default-dependency-versions.outputs.pennylane-lightning-latest }}
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
pytest_markers: jax and not qcut and not finite-diff and not param-shift
pytest_additional_args: --dist=loadscope --splits 4 --group ${{ matrix.group }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
pytest_additional_args: --dist=loadscope --splits 4 --group ${{ matrix.group }} ${{ needs.warnings-as-errors-setup.outputs.pytest_warning_args }}
pytest_durations_file_path: '.github/durations/jax_tests_durations.json'
requirements_file: ${{ github.event_name == 'schedule' && strategy.job-index == 0 && 'jax.txt' || '' }}

Expand All @@ -363,9 +377,9 @@ jobs:
- setup-ci-load
- determine_runner
- default-dependency-versions
- disable-fail-fast-wae
- warnings-as-errors-setup
strategy:
fail-fast: ${{ needs.disable-fail-fast-wae.outputs.fail_fast == 'default' }}
fail-fast: ${{ needs.warnings-as-errors-setup.outputs.fail_fast == 'default' }}
max-parallel: >-
${{
fromJSON(needs.setup-ci-load.outputs.matrix-max-parallel).core-tests
Expand All @@ -390,7 +404,7 @@ jobs:
additional_pip_packages_post: ${{ needs.default-dependency-versions.outputs.pennylane-lightning-latest }}
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
pytest_markers: core and not qcut and not finite-diff and not param-shift
pytest_additional_args: --splits 6 --group ${{ matrix.group }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
pytest_additional_args: --splits 6 --group ${{ matrix.group }} ${{ needs.warnings-as-errors-setup.outputs.pytest_warning_args }}
pytest_durations_file_path: '.github/durations/core_tests_durations.json'
requirements_file: ${{ github.event_name == 'schedule' && strategy.job-index == 0 && 'core.txt' || '' }}

Expand All @@ -400,9 +414,9 @@ jobs:
- setup-ci-load
- determine_runner
- default-dependency-versions
- disable-fail-fast-wae
- warnings-as-errors-setup
strategy:
fail-fast: ${{ needs.disable-fail-fast-wae.outputs.fail_fast == 'default' }}
fail-fast: ${{ needs.warnings-as-errors-setup.outputs.fail_fast == 'default' }}
max-parallel: >-
${{
fromJSON(needs.setup-ci-load.outputs.matrix-max-parallel).all-interfaces-tests
Expand Down Expand Up @@ -430,7 +444,7 @@ jobs:
additional_pip_packages_post: ${{ needs.default-dependency-versions.outputs.pennylane-lightning-latest }}
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
pytest_markers: all_interfaces
pytest_additional_args: -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
pytest_additional_args: ${{ needs.warnings-as-errors-setup.outputs.pytest_warning_args }}
requirements_file: ${{ github.event_name == 'schedule' && strategy.job-index == 0 && 'all_interfaces.txt' || '' }}


Expand All @@ -439,9 +453,9 @@ jobs:
- setup-ci-load
- determine_runner
- default-dependency-versions
- disable-fail-fast-wae
- warnings-as-errors-setup
strategy:
fail-fast: ${{ needs.disable-fail-fast-wae.outputs.fail_fast == 'default' }}
fail-fast: ${{ needs.warnings-as-errors-setup.outputs.fail_fast == 'default' }}
max-parallel: >-
${{
fromJSON(needs.setup-ci-load.outputs.matrix-max-parallel).external-libraries-tests
Expand All @@ -463,7 +477,7 @@ jobs:
python_version: ${{ matrix.python-version }}
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
pytest_markers: external
pytest_additional_args: -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
pytest_additional_args: ${{ needs.warnings-as-errors-setup.outputs.pytest_warning_args }}
additional_pip_packages: |
pyzx matplotlib stim quimb mitiq ply optax scipy-openblas32>=0.3.26
git+https://github.com/PennyLaneAI/pennylane-qiskit.git@master
Expand All @@ -480,9 +494,9 @@ jobs:
- setup-ci-load
- determine_runner
- default-dependency-versions
- disable-fail-fast-wae
- warnings-as-errors-setup
strategy:
fail-fast: ${{ needs.disable-fail-fast-wae.outputs.fail_fast == 'default' }}
fail-fast: ${{ needs.warnings-as-errors-setup.outputs.fail_fast == 'default' }}
max-parallel: >-
${{
fromJSON(needs.setup-ci-load.outputs.matrix-max-parallel).qcut-tests
Expand All @@ -504,7 +518,7 @@ jobs:
python_version: ${{ matrix.python-version }}
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
pytest_markers: qcut
pytest_additional_args: -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
pytest_additional_args: ${{ needs.warnings-as-errors-setup.outputs.pytest_warning_args }}
additional_pip_packages: |
kahypar==1.1.7
opt_einsum
Expand All @@ -520,9 +534,9 @@ jobs:
- setup-ci-load
- determine_runner
- default-dependency-versions
- disable-fail-fast-wae
- warnings-as-errors-setup
strategy:
fail-fast: ${{ needs.disable-fail-fast-wae.outputs.fail_fast == 'default' }}
fail-fast: ${{ needs.warnings-as-errors-setup.outputs.fail_fast == 'default' }}
max-parallel: >-
${{
fromJSON(needs.setup-ci-load.outputs.matrix-max-parallel).qchem-tests
Expand All @@ -545,7 +559,7 @@ jobs:
additional_pip_packages_post: ${{ needs.default-dependency-versions.outputs.pennylane-lightning-latest }}
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
pytest_markers: qchem
pytest_additional_args: -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
pytest_additional_args: ${{ needs.warnings-as-errors-setup.outputs.pytest_warning_args }}
additional_pip_packages: |
openfermionpyscf basis-set-exchange geometric scikit-learn
${{ inputs.additional_python_packages }}
Expand All @@ -555,9 +569,9 @@ jobs:
- setup-ci-load
- determine_runner
- default-dependency-versions
- disable-fail-fast-wae
- warnings-as-errors-setup
strategy:
fail-fast: ${{ needs.disable-fail-fast-wae.outputs.fail_fast == 'default' }}
fail-fast: ${{ needs.warnings-as-errors-setup.outputs.fail_fast == 'default' }}
max-parallel: >-
${{
fromJSON(needs.setup-ci-load.outputs.matrix-max-parallel).gradients-tests
Expand All @@ -580,7 +594,7 @@ jobs:
branch: ${{ inputs.branch }}
coverage_artifact_name: gradients-${{ matrix.config.suite }}-coverage
python_version: ${{ matrix.python-version }}
pytest_additional_args: -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
pytest_additional_args: ${{ needs.warnings-as-errors-setup.outputs.pytest_warning_args }}
additional_pip_packages: |
${{ needs.default-dependency-versions.outputs.jax-version }}
${{ needs.default-dependency-versions.outputs.tensorflow-version }}
Expand All @@ -596,9 +610,9 @@ jobs:
- setup-ci-load
- determine_runner
- default-dependency-versions
- disable-fail-fast-wae
- warnings-as-errors-setup
strategy:
fail-fast: ${{ needs.disable-fail-fast-wae.outputs.fail_fast == 'default' }}
fail-fast: ${{ needs.warnings-as-errors-setup.outputs.fail_fast == 'default' }}
max-parallel: >-
${{
fromJSON(needs.setup-ci-load.outputs.matrix-max-parallel).data-tests
Expand All @@ -620,7 +634,7 @@ jobs:
python_version: ${{ matrix.python-version }}
additional_pip_packages_post: ${{ needs.default-dependency-versions.outputs.pennylane-lightning-latest }}
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
pytest_additional_args: -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
pytest_additional_args: ${{ needs.warnings-as-errors-setup.outputs.pytest_warning_args }}
pytest_markers: data
additional_pip_packages: |
h5py
Expand All @@ -632,9 +646,9 @@ jobs:
- setup-ci-load
- determine_runner
- default-dependency-versions
- disable-fail-fast-wae
- warnings-as-errors-setup
strategy:
fail-fast: ${{ needs.disable-fail-fast-wae.outputs.fail_fast == 'default' }}
fail-fast: ${{ needs.warnings-as-errors-setup.outputs.fail_fast == 'default' }}
max-parallel: >-
${{
fromJSON(needs.setup-ci-load.outputs.matrix-max-parallel).device-tests
Expand Down Expand Up @@ -669,7 +683,7 @@ jobs:
additional_pip_packages_post: ${{ needs.default-dependency-versions.outputs.pennylane-lightning-latest }}
pytest_test_directory: pennylane/devices/tests
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
pytest_additional_args: --device=${{ matrix.config.device }} --shots=${{ matrix.config.shots }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
pytest_additional_args: --device=${{ matrix.config.device }} --shots=${{ matrix.config.shots }} ${{ needs.warnings-as-errors-setup.outputs.pytest_warning_args }}


upload-to-codecov:
Expand Down
Loading