← 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 PR #1933 migrated simple, machine, and Kubernetes charm templates from legacy Harness tests to ops.testing while preserving test coverage.

Resolution: closed resolved

Reason: PR #1933 was approved and merged as commit f9d17b0d. It replaced Harness usage across the three init profiles with ops.testing state-transition APIs.

Evaluated by: mr-cal-bot

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
stealth/space-bunny-alpha — closed resolved Merged PR #1933 migrated simple, machine, and Kubernetes charm templates from legacy Harness tests to ops.testing while preserving test coverage.
stealth/space-bunny-alpha — closed resolved Merged in #1933 via commit f9d17b0d, migrating simple, machine, and Kubernetes charm unit tests from the legacy Harness API to ops.testing while preserving test intent.
stealth/space-bunny-alpha — closed resolved Merged as f9d17b0d, updating simple, machine, and Kubernetes charm unit tests to use ops.testing instead of legacy Harness while preserving test coverage.
stealth/space-bunny-alpha — closed resolved Merged PR #1933 as commit f9d17b0d, migrating simple, machine, and Kubernetes charm tests from the legacy Harness API to ops.testing without changing test intent.
stealth/space-bunny-alpha — closed resolved Merged the ops.testing migration for simple, machine, and Kubernetes profile charm tests, replacing the legacy Harness API while preserving test intent and coverage.
stealth/space-bunny-alpha — closed resolved Merged in charmcraft#1933 (f9d17b0d), replacing legacy Harness tests with ops.testing classes across simple, machine, and Kubernetes profiles while preserving test logic.
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.

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 PR #2623 as commit 77c4d692, updating machine and Kubernetes charm templates to use pytest-jubilant for integration tests.
75%
#1911 feat: use ops.main() type hints charmcraft merged Updated charm templates to require ops 2.17.0 and pass the charm class to typed ops.main(); merged as commit 2fe53628.
71%