[Python] Tests failing when running `builder` tests with all others.
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.1k
- Forks
- 456
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 165
Description
Required prerequisites
- Consult the security policy. If reporting a security vulnerability, do not report the bug using this form. Use the process described in the policy to report the issue.
- Make sure you've read the documentation. Your issue may be addressed there.
- Search the issue tracker to verify that this hasn't already been reported. +1 or comment there if it has.
- If possible, make a PR with a failing test to give us a starting point to work on!
Describe the bug
The builder test seems to be breaking something when run together with all other tests. The issue does not happen when builder tests are run in isolation.
============================================ test session starts =============================================
platform linux -- Python 3.12.2, pytest-8.3.3, pluggy-1.5.0
rootdir: ~/dev/cuda-quantum
configfile: pyproject.toml
plugins: anyio-4.6.0
collected 654 items / 9 skipped
python/tests/backends/test_Quantinuum_LocalEmulation_builder.py ....... [ 1%]
python/tests/backends/test_Quantinuum_LocalEmulation_kernel.py ............ [ 2%]
python/tests/backends/test_stim.py ..... [ 3%]
python/tests/custom/test_custom_operations.py ................ [ 6%]
python/tests/custom/test_euler_decomposition.py ... [ 6%]
python/tests/custom/test_kak_decomposition.py .. [ 6%]
python/tests/domains/test_qnn.py .. [ 7%]
python/tests/handlers/test_photonics_kernel.py .......s.. [ 8%]
python/tests/interop/test_interop.py ......... [ 10%]
python/tests/kernel/test_adjoint_operations.py ........ [ 11%]
python/tests/kernel/test_control_operations.py .......... [ 12%]
python/tests/kernel/test_ir_operations.py ... [ 13%]
python/tests/kernel/test_kernel_complex.py ................. [ 15%]
python/tests/kernel/test_kernel_exp_pauli.py .. [ 16%]
python/tests/kernel/test_kernel_features.py .......................................................... [ 25%]
.............. [ 27%]
python/tests/kernel/test_kernel_float.py ............... [ 29%]
python/tests/kernel/test_kernel_qvector_init.py .......................... [ 33%]
python/tests/kernel/test_kernel_qvector_state_init.py ...................... [ 36%]
python/tests/kernel/test_kernel_qview.py .. [ 37%]
python/tests/kernel/test_kernel_return.py ................. [ 39%]
python/tests/kernel/test_kernel_translate.py ................. [ 42%]
python/tests/kernel/test_library_kernels.py . [ 42%]
python/tests/kernel/test_observe_kernel.py ......... [ 43%]
python/tests/kernel/test_sample_kernel.py ..... [ 44%]
python/tests/kernel/test_state_kernel.py ..... [ 45%]
python/tests/kernel/test_trotter.py .. [ 45%]
python/tests/kernel/test_vqe_kernel.py ..... [ 46%]
python/tests/mlir/test_output_qir.py . [ 46%]
python/tests/mlir/test_output_translate_openqasm.py . [ 46%]
python/tests/mlir/test_output_translate_qir.py . [ 46%]
python/tests/parallel/test_mpi_api.py s [ 47%]
python/tests/parallel/test_mpi_mqpu.py ss [ 47%]
python/tests/parallel/test_mqpu.py ........ [ 48%]
python/tests/visualization/test_draw.py .. [ 48%]
python/tests/builder/test_NoiseModel.py .Fatal Python error: Aborted
Current thread 0x000071f80da53740 (most recent call first):
File "~/dev/cuda-quantum/build/python/cudaq/runtime/sample.py", line 88 in sample
File "~/dev/cuda-quantum/build/python/tests/builder/test_NoiseModel.py", line 31 in test_depolarization_channel
File "~/miniconda3/envs/cudaq/lib/python3.12/site-packages/_pytest/python.py", line 159 in pytest_pyfunc_call
File "~/miniconda3/envs/cudaq/lib/python3.12/site-packages/pluggy/_callers.py", line 103 in _multicall
File "~/miniconda3/envs/cudaq/lib/python3.12/site-packages/pluggy/_manager.py", line 120 in _hookexec
File "~/miniconda3/envs/cudaq/lib/python3.12/site-packages/pluggy/_hooks.py", line 513 in __call__
File "~/miniconda3/envs/cudaq/lib/python3.12/site-packages/_pytest/python.py", line 1627 in runtest
File "~/miniconda3/envs/cudaq/lib/python3.12/site-packages/_pytest/runner.py", line 174 in pytest_runtest_call
File "~/miniconda3/envs/cudaq/lib/python3.12/site-packages/pluggy/_callers.py", line 103 in _multicall
File "~/miniconda3/envs/cudaq/lib/python3.12/site-packages/pluggy/_manager.py", line 120 in _hookexec
File "~/miniconda3/envs/cudaq/lib/python3.12/site-packages/pluggy/_hooks.py", line 513 in __call__
File "~/miniconda3/envs/cudaq/lib/python3.12/site-packages/_pytest/runner.py", line 242 in <lambda>
File "~/miniconda3/envs/cudaq/lib/python3.12/site-packages/_pytest/runner.py", line 341 in from_call
File "~/miniconda3/envs/cudaq/lib/python3.12/site-packages/_pytest/runner.py", line 241 in call_and_report
File "~/miniconda3/envs/cudaq/lib/python3.12/site-packages/_pytest/runner.py", line 132 in runtestprotocol
File "~/miniconda3/envs/cudaq/lib/python3.12/site-packages/_pytest/runner.py", line 113 in pytest_runtest_protocol
File "~/miniconda3/envs/cudaq/lib/python3.12/site-packages/pluggy/_callers.py", line 103 in _multicall
File "~/miniconda3/envs/cudaq/lib/python3.12/site-packages/pluggy/_manager.py", line 120 in _hookexec
File "~/miniconda3/envs/cudaq/lib/python3.12/site-packages/pluggy/_hooks.py", line 513 in __call__
File "~/miniconda3/envs/cudaq/lib/python3.12/site-packages/_pytest/main.py", line 362 in pytest_runtestloop
File "~/miniconda3/envs/cudaq/lib/python3.12/site-packages/pluggy/_callers.py", line 103 in _multicall
File "~/miniconda3/envs/cudaq/lib/python3.12/site-packages/pluggy/_manager.py", line 120 in _hookexec
File "~/miniconda3/envs/cudaq/lib/python3.12/site-packages/pluggy/_hooks.py", line 513 in __call__
File "~/miniconda3/envs/cudaq/lib/python3.12/site-packages/_pytest/main.py", line 337 in _main
File "~/miniconda3/envs/cudaq/lib/python3.12/site-packages/_pytest/main.py", line 283 in wrap_session
File "~/miniconda3/envs/cudaq/lib/python3.12/site-packages/_pytest/main.py", line 330 in pytest_cmdline_main
File "~/miniconda3/envs/cudaq/lib/python3.12/site-packages/pluggy/_callers.py", line 103 in _multicall
File "~/miniconda3/envs/cudaq/lib/python3.12/site-packages/pluggy/_manager.py", line 120 in _hookexec
File "~/miniconda3/envs/cudaq/lib/python3.12/site-packages/pluggy/_hooks.py", line 513 in __call__
File "~/miniconda3/envs/cudaq/lib/python3.12/site-packages/_pytest/config/__init__.py", line 175 in main
File "~/miniconda3/envs/cudaq/lib/python3.12/site-packages/_pytest/config/__init__.py", line 201 in console_main
File "~/miniconda3/envs/cudaq/bin/pytest", line 8 in <module>
Extension modules: numpy.core._multiarray_umath, numpy.core._multiarray_tests, numpy.linalg._umath_linalg, numpy.fft._pocketfft_internal, numpy.random._common, numpy.random.bit_generator, numpy.random._bounded_integers, numpy.random._mt19937, numpy.random.mtrand, numpy.random._philox, numpy.random._pcg64, numpy.random._sfc64, numpy.random._generator (total: 13)
Aborted (core dumped)
When run in isolation:
============================================ test session starts =============================================
platform linux -- Python 3.12.2, pytest-8.3.3, pluggy-1.5.0
rootdir: ~/dev/cuda-quantum
configfile: pyproject.toml
plugins: anyio-4.6.0
collected 334 items / 1 skipped
python/tests/builder/test_NoiseModel.py .................... [ 5%]
python/tests/builder/test_SpinOperator.py ............. [ 9%]
python/tests/builder/test_kernel_builder.py ................................................ [ 24%]
python/tests/builder/test_observe.py ................................ [ 33%]
python/tests/builder/test_optimizer.py .............................................. [ 47%]
python/tests/builder/test_qalloc_init.py ....................................... [ 59%]
python/tests/builder/test_qalloc_init_state.py ................... [ 64%]
python/tests/builder/test_qpp_target.py . [ 65%]
python/tests/builder/test_quake_value.py ..... [ 66%]
python/tests/builder/test_sample.py ...........................sssssssss............ [ 81%]
python/tests/builder/test_state.py ..... [ 82%]
python/tests/builder/test_vqe.py .......................................................... [100%]
====================================== 325 passed, 10 skipped in 19.16s ======================================
Steps to reproduce the bug
Run: pytest python/tests/backends/ python/tests/custom/ python/tests/domains/ python/tests/handlers/ python/tests/interop/ python/tests/kernel/ python/tests/mlir/ python/tests/mlir/ python/tests/parallel/ python/tests/utils/ python/tests/visualization/ python/tests/builder/
Expected behavior
Tests to pass.
Is this a regression? If it is, put the last known working version (or commit) here.
Not a regression
Environment
- CUDA Quantum version: proto-0.8.0 (https://github.com/NVIDIA/cuda-quantum a9e2324f6504f02e47a87e1de82c8f31cbb0f46b)
- Python version: 3.12
- Operating system: ubuntu 24.04
Suggestions
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the reported pytest command and compare it with the isolated builder suite. Inspect python/tests/builder/test_NoiseModel.py, especially test_depolarization_channel, and the runtime path shown at build/python/cudaq/runtime/sample.py line 88. Done means the full listed test suite completes without aborting, as the builder suite already does in isolation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100