Skip to content

Conversation

khalatepradnya
Copy link
Collaborator

@khalatepradnya khalatepradnya commented Sep 10, 2025

This PR refactors test environment setup across multiple Python test files. The setup fixtures now ensure that kernel registries are cleared before tests run, which improves test isolation and reliability.

  • Replaced various do_something fixtures with a unified setup_test_environment fixture for consistent test initialization and teardown.
  • Standardized import ordering to group standard library, third-party, and local imports.
  • Refactored the uccsd tests: No change if running stand-alone, patch module if kernel registries cleared prior to running. (See issue [Python] [tests] Chemistry tests rely on prebuilt kernels #1954 )

WIP: Issue#1954

Signed-off-by: Pradnya Khalate <pkhalate@nvidia.com>
…UCCSD module that bypasses kernel registry dependencies, so as to ensure reliable test execution.

Signed-off-by: Pradnya Khalate <pkhalate@nvidia.com>
github-actions bot pushed a commit that referenced this pull request Sep 10, 2025
Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

@khalatepradnya khalatepradnya marked this pull request as ready for review September 10, 2025 23:37
@khalatepradnya khalatepradnya added the testing Relates to testing label Sep 10, 2025
@pytest.fixture(autouse=True)
def setup_test_environment():
cudaq.__clearKernelRegistries()
yield
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here after the yield, we will need to clean up the kernel registries, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe I'm missing why?

Copy link
Collaborator

@sacpis sacpis left a comment

Choose a reason for hiding this comment

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

Left a few comments. Thanks @khalatepradnya for fixing these tests.

github-actions bot pushed a commit that referenced this pull request Sep 11, 2025
Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

  be found,. In this case, we cannot proceed with testing.

Signed-off-by: Pradnya Khalate <pkhalate@nvidia.com>
github-actions bot pushed a commit that referenced this pull request Sep 15, 2025
Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

github-actions bot pushed a commit that referenced this pull request Sep 16, 2025
github-actions bot pushed a commit that referenced this pull request Sep 20, 2025
Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

github-actions bot pushed a commit that referenced this pull request Sep 25, 2025
Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing Relates to testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants