Skip to content

Moving the mock_qpu utils under python#4707

Open
Renaud-K wants to merge 4 commits into
NVIDIA:mainfrom
Renaud-K:mock-utils
Open

Moving the mock_qpu utils under python#4707
Renaud-K wants to merge 4 commits into
NVIDIA:mainfrom
Renaud-K:mock-utils

Conversation

@Renaud-K

@Renaud-K Renaud-K commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Recent changes to the test directories have caused the python backend tests to be skipped. The reason for skipping the tests is that if the mock_qpu module is not found the test explicitly skips it:

Example for IQM:

try:
    from utils.mock_qpu.iqm import startServer
    from utils.mock_qpu.iqm.mock_iqm_cortex_cli import write_a_mock_tokens_file
except:
    pytest.skip("Mock qpu not available, skipping IQM tests.",
                allow_module_level=True)

I am proposing 2 changes in this PR to address this issue:

  1. Move the utils.mock_qpu modules under python/utils so they are copied together with the tests to the CMAKE_BINARY_DIR
  2. Error if the module is not found. The skip might have been there for historical reasons. As off today all these mock_qpus exist so there is no reason that I know of to skip the test. There is a separate check if dependencies are missing and the test indeed needs to be skipped such as:
iqm_client = pytest.importorskip("iqm.iqm_client")

Signed-off-by: Renaud Kauffmann <rkauffmann@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented Jun 9, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@Renaud-K

Renaud-K commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator Author

/ok to test 1aaa011

Command Bot: Processing...

Comment thread unittests/backends/anyon/AnyonStartServerAndTest.sh.in Outdated

@sacpis sacpis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM. Thanks @Renaud-K. Just will need to removed !utils/mock_qpu/qci/__init__.py from .github/pre-commit/spellcheck_config.yml.

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

CI Summary (push) — ✅ passed

Run #27247042119 · ✅ 6 · ⏩ 7 · ❌ 0 · ⛔ 0

Top-level jobs (13)
Job Result
binaries ⏩ skipped
build_and_test ✅ success
config_devdeps ✅ success
config_source_build ⏩ skipped
config_wheeldeps ✅ success
devdeps ✅ success
docker_image ⏩ skipped
gen_code_coverage ⏩ skipped
metadata ✅ success
python_metapackages ⏩ skipped
python_wheels ⏩ skipped
source_build ⏩ skipped
wheeldeps ✅ success
⏩ Skipped jobs (7) — intentionally skipped on PR builds; run on merge_group / workflow_dispatch
Job
binaries
config_source_build
docker_image
gen_code_coverage
python_metapackages
python_wheels
source_build
All sub-jobs (42) — every matrix leg, with links
Job Status Link
Build and test (amd64, gcc12, openmpi) / Dev environment (Debug) ✅ success view
Build and test (amd64, gcc12, openmpi) / Dev environment (Python) ✅ success view
Build and test (amd64, llvm, openmpi) / Dev environment (Debug) ✅ success view
Build and test (amd64, llvm, openmpi) / Dev environment (Python) ✅ success view
Build and test (arm64, llvm, openmpi) / Dev environment (Debug) ✅ success view
Build and test (arm64, llvm, openmpi) / Dev environment (Python) ✅ success view
CI Summary ❔ in_progress view
Configure build (devdeps) ✅ success view
Configure build (source_build) ⏩ skipped view
Configure build (wheeldeps) ✅ success view
Create CUDA Quantum installer ⏩ skipped view
Create Docker images ⏩ skipped view
Create Python metapackages ⏩ skipped view
Create Python wheels ⏩ skipped view
Gen code coverage ⏩ skipped view
Load dependencies (amd64, gcc12) / Caching ✅ success view
Load dependencies (amd64, gcc12) / Finalize ✅ success view
Load dependencies (amd64, gcc12) / Metadata ✅ success view
Load dependencies (amd64, llvm) / Caching ✅ success view
Load dependencies (amd64, llvm) / Finalize ✅ success view
Load dependencies (amd64, llvm) / Metadata ✅ success view
Load dependencies (arm64, gcc12) / Caching ✅ success view
Load dependencies (arm64, gcc12) / Finalize ✅ success view
Load dependencies (arm64, gcc12) / Metadata ✅ success view
Load dependencies (arm64, llvm) / Caching ✅ success view
Load dependencies (arm64, llvm) / Finalize ✅ success view
Load dependencies (arm64, llvm) / Metadata ✅ success view
Load source build cache ⏩ skipped view
Load wheel dependencies (amd64, 12.6) / Caching ✅ success view
Load wheel dependencies (amd64, 12.6) / Finalize ✅ success view
Load wheel dependencies (amd64, 12.6) / Metadata ✅ success view
Load wheel dependencies (amd64, 13.0) / Caching ✅ success view
Load wheel dependencies (amd64, 13.0) / Finalize ✅ success view
Load wheel dependencies (amd64, 13.0) / Metadata ✅ success view
Load wheel dependencies (arm64, 12.6) / Caching ✅ success view
Load wheel dependencies (arm64, 12.6) / Finalize ✅ success view
Load wheel dependencies (arm64, 12.6) / Metadata ✅ success view
Load wheel dependencies (arm64, 13.0) / Caching ✅ success view
Load wheel dependencies (arm64, 13.0) / Finalize ✅ success view
Load wheel dependencies (arm64, 13.0) / Metadata ✅ success view
Prepare cache clean-up ❔ in_progress view
Retrieve PR info ✅ success view
✅ Required checks (6/6) — declared in .github/required-checks.yml for push
Required check Status Link
Build and test (amd64, llvm, openmpi) / Dev environment (Debug) ✅ success view
Build and test (amd64, llvm, openmpi) / Dev environment (Python) ✅ success view
Build and test (arm64, llvm, openmpi) / Dev environment (Debug) ✅ success view
Build and test (arm64, llvm, openmpi) / Dev environment (Python) ✅ success view
Build and test (amd64, gcc12, openmpi) / Dev environment (Debug) ✅ success view
Build and test (amd64, gcc12, openmpi) / Dev environment (Python) ✅ success view

Signed-off-by: Renaud Kauffmann <rkauffmann@nvidia.com>
@Renaud-K

Renaud-K commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator Author

/ok to test 48816cf

Command Bot: Processing...

@schweitzpgi

schweitzpgi commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

As off today all these mock_qpus exist so there is no reason that I know of to skip the test.

It is possible to build the code without supporting any/all backends. I don't know if that is related, but it would be strange to run an IQM mock server test without an IQM backend, for example, no?

@Renaud-K

Copy link
Copy Markdown
Collaborator Author

It is possible to build the code without supporting any/all backends. I don't know if that is related, but it would be strange to run an IQM mock server test without an IQM backend, for example, no?

These are skipped with

iqm_client = pytest.importorskip("iqm.iqm_client")

and there are higher level skips in the cmake files as you know.

But once they ran and hit the mock_qpu imports, they were never skipped because all these files are there. The skip was dangerous because it silently missed tests.

Signed-off-by: Renaud Kauffmann <rkauffmann@nvidia.com>
@Renaud-K

Renaud-K commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator Author

/ok to test 1794b7b

Command Bot: Processing...

@mitchdz

mitchdz commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Could these changes be added to test_Quantum_Machines.py as well?

Signed-off-by: Renaud Kauffmann <rkauffmann@nvidia.com>
@Renaud-K

Renaud-K commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator Author

/ok to test 00c4ab0

Command Bot: Processing...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants