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

Enable warnings as errors for weekly run in test suite #6217

Open
wants to merge 70 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
0237e48
Enable warnings as errors globally in test suite
mlxd Sep 4, 2024
124c444
Ensure all warnings are errors in devices
mlxd Sep 4, 2024
65301db
Merge branch 'master' into tests/warning_as_error
mlxd Sep 9, 2024
261e6b1
Add nightly run warnings as errors tests
mlxd Sep 12, 2024
16d4f01
Merge branch 'master' into tests/warning_as_error
mlxd Sep 12, 2024
c7ecbe4
Update pennylane/devices/tests/pytest.ini
mlxd Sep 12, 2024
6c824a7
Update tests/pytest.ini
mlxd Sep 12, 2024
23a9765
Update CL
mlxd Sep 12, 2024
d7099d2
Merge branch 'tests/warning_as_error' of github.com:PennyLaneAI/penny…
mlxd Sep 12, 2024
85d6a4d
Required to false for python warning env var
mlxd Sep 12, 2024
55aa823
Remove pipeline from yml and add PR dispatch
mlxd Sep 12, 2024
ccdeef8
Readd error from warning to all CI runs
mlxd Sep 12, 2024
a904d48
Readd missing secrets
mlxd Sep 12, 2024
37fd0cf
Readd missing secrets again
mlxd Sep 12, 2024
07b1f6c
Readd missing secrets again
mlxd Sep 12, 2024
0dd65a7
Cancel CI [skip-ci]
mlxd Sep 12, 2024
13e31ba
Merge branch 'tests/warning_as_error' of github.com:PennyLaneAI/penny…
mlxd Sep 12, 2024
80292eb
Remove secrets
mlxd Sep 12, 2024
00a9e1c
Migrate location again
mlxd Sep 12, 2024
bb104c1
Disable fail-fast for runs
mlxd Sep 12, 2024
eccbf9a
Migate env-var to inline warning for pytest
mlxd Sep 13, 2024
09f5529
Merge branch 'master' into tests/warning_as_error
mlxd Sep 13, 2024
15417e8
Change warning capitalization
mlxd Sep 13, 2024
6ce1b72
Merge branch 'tests/warning_as_error' of github.com:PennyLaneAI/penny…
mlxd Sep 13, 2024
4591c1b
Once more with env var inclusion
mlxd Sep 13, 2024
872e267
reduce concurrent workers
mlxd Sep 13, 2024
0e70c30
Remove durations
mlxd Sep 13, 2024
a4d90e3
Remove splitting from warning CI
mlxd Sep 13, 2024
786e826
Fix GHA YML syntax error
mlxd Sep 13, 2024
212733f
Attempt to set strategy for sub-action
mlxd Sep 13, 2024
5a41914
Attempt to set strategy for sub-action again
mlxd Sep 13, 2024
0373a52
Move with branch in yaml
mlxd Sep 13, 2024
523235c
Make required item optional
mlxd Sep 13, 2024
07b51b7
Ignore import warnings due to external packages
mlxd Sep 13, 2024
749fa01
Add conditional splitting support when using WAE
mlxd Sep 13, 2024
80b483d
Add fromJson
mlxd Sep 13, 2024
a5de614
Try coerce GHA to accept the matrix values
mlxd Sep 13, 2024
2c0c8dc
Try coerce GHA to accept the matrix values again
mlxd Sep 13, 2024
5f197aa
Try coerce GHA to accept the matrix values again+1
mlxd Sep 13, 2024
124431c
Update .github/workflows/interface-unit-tests.yml
mlxd Sep 13, 2024
6c2ae74
Treat the conditional section as objects with fromJson
mlxd Sep 13, 2024
4adffd8
More coercing
mlxd Sep 13, 2024
144b321
Remove splits when not required
mlxd Sep 13, 2024
6eac2a2
Downgrade py versions
mlxd Sep 13, 2024
7ada97b
Add pandas to avoid import errors in WAE
mlxd Sep 13, 2024
67e79ec
Remove durations and ensure no lightened settings
mlxd Sep 13, 2024
9e1ced3
Ensure continue on collection errors
mlxd Sep 13, 2024
e7463f0
Update .github/workflows/interface-unit-tests.yml
mlxd Sep 13, 2024
d3d0529
Merge branch 'master' into tests/warning_as_error
mlxd Sep 13, 2024
95822bc
Update .github/workflows/interface-unit-tests.yml
mlxd Sep 13, 2024
a746721
Update .github/workflows/interface-unit-tests.yml
mlxd Sep 13, 2024
2d418d2
Update .github/workflows/package_warnings_as_errors.yml
mlxd Sep 13, 2024
ade9049
Update .github/workflows/package_warnings_as_errors.yml
mlxd Sep 13, 2024
9589c9f
Fix durations
mlxd Sep 13, 2024
6f68114
Always include split package
mlxd Sep 13, 2024
12d74b8
reformat string structure
mlxd Sep 13, 2024
b37ab75
Need more output
mlxd Sep 13, 2024
392ec4e
More formatting checks
mlxd Sep 13, 2024
79a80ec
Once more
mlxd Sep 13, 2024
896bca1
Add paren
mlxd Sep 13, 2024
a5bbfe9
JAXIT
mlxd Sep 13, 2024
e9a7c8b
More echo
mlxd Sep 13, 2024
ecc4383
More echo
mlxd Sep 13, 2024
3bf4428
TF group check
mlxd Sep 13, 2024
a44a8db
Multiple groupings
mlxd Sep 13, 2024
3258d2c
More darting with TF tests
mlxd Sep 13, 2024
33495fe
Enable debug logging
mlxd Sep 13, 2024
dd9a24b
Merge branch 'master' into tests/warning_as_error
mlxd Sep 13, 2024
33cbeb2
Enable debug logging+1
mlxd Sep 13, 2024
01df56b
Merge branch 'tests/warning_as_error' of github.com:PennyLaneAI/penny…
mlxd Sep 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/interface-unit-tests.yml
mlxd marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ on:
required: false
type: boolean
default: false
python_warning_level:
description: Sets the default Python warning level as defined by https://docs.python.org/3/using/cmdline.html#envvar-PYTHONWARNINGS
required: true
type: string
default: 'default'

jobs:
setup-ci-load:
Expand Down Expand Up @@ -168,6 +173,7 @@ jobs:
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' || '' }}
disable_new_opmath: ${{ inputs.disable_new_opmath }}
python_warning_level: ${{ inputs.python_warning_level }}


autograd-tests:
Expand Down Expand Up @@ -200,6 +206,7 @@ jobs:
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
pytest_markers: autograd and not qcut and not finite-diff and not param-shift
disable_new_opmath: ${{ inputs.disable_new_opmath }}
python_warning_level: ${{ inputs.python_warning_level }}


tf-tests:
Expand Down Expand Up @@ -238,6 +245,7 @@ jobs:
additional_pip_packages: pytest-split
requirements_file: ${{ github.event_name == 'schedule' && strategy.job-index == 0 && 'tf.txt' || '' }}
disable_new_opmath: ${{ inputs.disable_new_opmath }}
python_warning_level: ${{ inputs.python_warning_level }}


jax-tests:
Expand Down Expand Up @@ -276,6 +284,7 @@ jobs:
additional_pip_packages: pytest-split
requirements_file: ${{ github.event_name == 'schedule' && strategy.job-index == 0 && 'jax.txt' || '' }}
disable_new_opmath: ${{ inputs.disable_new_opmath }}
python_warning_level: ${{ inputs.python_warning_level }}


core-tests:
Expand Down Expand Up @@ -314,6 +323,7 @@ jobs:
additional_pip_packages: pytest-split
requirements_file: ${{ github.event_name == 'schedule' && strategy.job-index == 0 && 'core.txt' || '' }}
disable_new_opmath: ${{ inputs.disable_new_opmath }}
python_warning_level: ${{ inputs.python_warning_level }}


all-interfaces-tests:
Expand Down Expand Up @@ -347,6 +357,7 @@ jobs:
pytest_markers: all_interfaces
requirements_file: ${{ github.event_name == 'schedule' && strategy.job-index == 0 && 'all_interfaces.txt' || '' }}
disable_new_opmath: ${{ inputs.disable_new_opmath }}
python_warning_level: ${{ inputs.python_warning_level }}


external-libraries-tests:
Expand Down Expand Up @@ -386,6 +397,7 @@ jobs:
additional_pip_packages: pyzx matplotlib stim quimb mitiq pennylane-qiskit ply
requirements_file: ${{ github.event_name == 'schedule' && strategy.job-index == 0 && 'external.txt' || '' }}
disable_new_opmath: ${{ inputs.disable_new_opmath }}
python_warning_level: ${{ inputs.python_warning_level }}


qcut-tests:
Expand Down Expand Up @@ -419,6 +431,7 @@ jobs:
pytest_markers: qcut
additional_pip_packages: kahypar==1.1.7 opt_einsum
disable_new_opmath: ${{ inputs.disable_new_opmath }}
python_warning_level: ${{ inputs.python_warning_level }}


qchem-tests:
Expand Down Expand Up @@ -452,6 +465,7 @@ jobs:
pytest_markers: qchem
additional_pip_packages: openfermionpyscf basis-set-exchange
disable_new_opmath: ${{ inputs.disable_new_opmath }}
python_warning_level: ${{ inputs.python_warning_level }}

gradients-tests:
needs:
Expand Down Expand Up @@ -486,6 +500,7 @@ jobs:
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
pytest_markers: ${{ matrix.config.suite }}
disable_new_opmath: ${{ inputs.disable_new_opmath }}
python_warning_level: ${{ inputs.python_warning_level }}


data-tests:
Expand Down Expand Up @@ -519,6 +534,7 @@ jobs:
pytest_markers: data
additional_pip_packages: h5py
disable_new_opmath: ${{ inputs.disable_new_opmath }}
python_warning_level: ${{ inputs.python_warning_level }}


device-tests:
Expand Down Expand Up @@ -559,6 +575,7 @@ jobs:
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
pytest_additional_args: --device=${{ matrix.config.device }} --shots=${{ matrix.config.shots }}
disable_new_opmath: ${{ inputs.disable_new_opmath }}
python_warning_level: ${{ inputs.python_warning_level }}


upload-to-codecov:
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/package_warnings_as_errors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Test-suite with warnings as error
on:
# Scheduled trigger every Sunday at 2:35am UTC
schedule:
- cron: '35 2 * * 0'
workflow_dispatch:

concurrency:
group: unit-tests-${{ github.ref }}
cancel-in-progress: true

env:
DURATIONS_BRANCH: bot/durations-update
mlxd marked this conversation as resolved.
Show resolved Hide resolved

jobs:
test-warnings-as-errors:
uses: ./.github/workflows/interface-unit-tests.yml
secrets:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
with:
branch: ${{ github.ref }}
pipeline_mode: 'warnings-as-errors'
mlxd marked this conversation as resolved.
Show resolved Hide resolved
run_lightened_ci: false
skip_ci_test_jobs: 'qcut-tests'
mlxd marked this conversation as resolved.
Show resolved Hide resolved
python_warning_level: 'error'
6 changes: 6 additions & 0 deletions .github/workflows/unit-test.yml
mlxd marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ on:
required: false
type: string
default: "False"
python_warning_level:
description: Sets the default Python warning level as defined by https://docs.python.org/3/using/cmdline.html#envvar-PYTHONWARNINGS
required: true
type: string
default: 'default'

jobs:
test:
Expand Down Expand Up @@ -187,6 +192,7 @@ jobs:
- name: Run PennyLane Unit Tests
if: steps.continue.outputs.confirm == 'true'
env:
PYTHONWARNINGS: ${{ inputs.python_warning_level }}
mlxd marked this conversation as resolved.
Show resolved Hide resolved
PYTEST_MARKER: ${{ inputs.pytest_markers != '' && format('-m "{0}"', inputs.pytest_markers) || '' }}
COV_CORE_SOURCE: pennylane
COV_CORE_CONFIG: .coveragerc
Expand Down
3 changes: 3 additions & 0 deletions doc/releases/changelog-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@

<h3>Documentation 📝</h3>

* Add reporting of test warnings as failures.
[(#6217)](https://github.com/PennyLaneAI/pennylane/pull/6217)

<h3>Bug fixes 🐛</h3>

* Fix a bug where zero-valued JVPs were calculated wrongly in the presence of shot vectors.
Expand Down
2 changes: 1 addition & 1 deletion pennylane/devices/tests/pytest.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[pytest]
markers =
skip_unsupported: skip a test if it uses an operation unsupported on a device
addopts = --benchmark-disable
addopts = --benchmark-disable
7 changes: 0 additions & 7 deletions tests/pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,5 @@ markers =
logging: marks tests for pennylane logging
external: marks tests that require external packages such as matplotlib and PyZX
catalyst: marks tests for catalyst testing (select with '-m "catalyst"')
filterwarnings =
ignore::DeprecationWarning:autograd.numpy.numpy_wrapper
ignore:Casting complex values to real::autograd.numpy.numpy_wrapper
ignore:Casting complex values to real discards the imaginary part:UserWarning:torch.autograd
ignore:Call to deprecated create function:DeprecationWarning
ignore:the imp module is deprecated:DeprecationWarning
error::pennylane.PennyLaneDeprecationWarning
mlxd marked this conversation as resolved.
Show resolved Hide resolved
addopts = --benchmark-disable
xfail_strict=true
Loading