← Back to issue list

feat: use the newer ops.testing classes for the charm unit tests

View original Github issue

Metadata

Project
charmcraft
Number
#1933
Type
pull request
State
merged
Author
tonyandrewmeyer
Labels
Created
Updated
Closed

Current evaluation

Merged update replacing the legacy Harness API with newer ops.testing classes across simple, machine, and kubernetes profile unit tests. Approved by two reviewers with passing CI checks. Test logic remains unchanged.

Suggested action:

No scores available.

Issue body

Updates the `simple`, `machine`, and `kubernetes` profiles to use the ops.testing state transition classes (previously: Scenario) rather than the legacy Harness API. The content of what each set of tests is testing remains unchanged, it's just using the new API to do the tests. `ops[testing]` is installed via the tox dependencies (but should likely be in an optional dependencies group in the future, once CC005 is finalised). I've included it in the `static` dependencies as well, because as the charm gains additional tests those should also be statically checked and that will require the `ops[testing]` classes.

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b Merged update replacing the legacy Harness API with newer ops.testing classes across simple, machine, and kubernetes profile unit tests. Approved by two reviewers with passing CI checks. Test logic remains unchanged.
qwen3.6-35b-a3b-mtp-q6 Merged update replacing legacy Harness API with newer ops.testing classes across simple, machine, and kubernetes profile tests. Logic unchanged. Added ops[testing] to tox static dependencies for static analysis.
qwen3.6-35b-a3b-mtp-q6 Merged. Updated charm unit tests for simple, machine, and kubernetes profiles to use the newer ops.testing classes instead of the legacy Harness API. Added ops[testing] to tox static dependencies without altering test logic.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#2623 feat: update charm templates to use pytest-jubilant charmcraft merged Merged to main. Updates machine and Kubernetes charm templates to use pytest-jubilant, aligning with parallel Ops documentation changes. Approved by three reviewers and integrated after CI validation.
76%