Skip to content

Commit

Permalink
refactor: move the content of ops.testing to ops._private.harness (ca…
Browse files Browse the repository at this point in the history
…nonical#1369)

Moves the content of `ops/testing.py` to `ops/_private/harness.py`, and
then re-exposes all the names in the `ops.testing` namespace (other than
standard library and third-party modules).

This allows other testing frameworks (such as Scenario) to be exposed in
the `ops.testing` namespace while also building on top of the existing
testing code.
  • Loading branch information
tonyandrewmeyer committed Oct 4, 2024
1 parent 709bc3a commit 7d3927a
Show file tree
Hide file tree
Showing 7 changed files with 3,906 additions and 3,829 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/db-charm-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ jobs:
commit: 01cfd3e268ecd5024ded6bb6aede43ff85417b78 # 2024-09-11T16:07:20Z
- charm-repo: canonical/postgresql-k8s-operator
commit: f203e4d9d3ab9856b5dc0786217fce8428384e90 # 2024-09-16T12:00:58Z
- charm-repo: canonical/mysql-operator
commit: 4ff2dc867a1586d43a93d0017cc648d591fc9886 # 2024-09-13T15:38:12Z
# Waiting for an upstream PR:
# https://github.com/canonical/mysql-operator/pull/519
#- charm-repo: canonical/mysql-operator
# commit: 4ff2dc867a1586d43a93d0017cc648d591fc9886 # 2024-09-13T15:38:12Z
- charm-repo: canonical/mysql-k8s-operator
commit: 2009919583eddad22656b9b4ebe95adbcd518c0f # rev199 rev198 2024-09-16T18:14:16Z
steps:
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/observability-charm-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ jobs:
matrix:
include:
- charm-repo: canonical/alertmanager-k8s-operator
commit: 7518ec8343941ca91248614fd8f2d50fdd9e068c # rev135 2024-09-06T12:10:02Z
- charm-repo: canonical/prometheus-k8s-operator
commit: 1bd9e7fd96a9f5a91443e5932667c58a92c1ce5e # 2024-09-03T14:57:42Z
- charm-repo: canonical/grafana-k8s-operator
commit: 1c80f746f8edeae6fd23ddf31eed45f5b88c06b4 # rev118 2024-08-12T14:02:32Z
commit: 4b2f567c43bc67e9d1fe24f018ba186dcd0396ed # 2024-08-28T11:32:28Z
# Waiting for an upstream PR:
# https://github.com/canonical/prometheus-k8s-operator/pull/639
#- charm-repo: canonical/prometheus-k8s-operator
# commit: 7518ec8343941ca91248614fd8f2d50fdd9e068c # rev135 2024-09-06T12:10:02Z
# Waiting for an upstream PR:
# https://github.com/canonical/grafana-k8s-operator/pull/347
#- charm-repo: canonical/grafana-k8s-operator
# commit: 1bd9e7fd96a9f5a91443e5932667c58a92c1ce5e # 2024-09-03T14:57:42Z
steps:
- name: Checkout the ${{ matrix.charm-repo }} repository
uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions docs/custom_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ def _compute_navigation_tree(context):
('py:class', '_TextOrBinaryIO'),
('py:class', '_WarningDict'),
('py:class', '_Writeable'),
('py:obj', 'ops._private.harness.CharmType'),
('py:class', 'ops._private.harness.CharmType'),
('py:class', 'ops.charm._ContainerBaseDict'),
('py:class', 'ops.model._AddressDict'),
('py:class', 'ops.model._GenericLazyMapping'),
Expand Down
6 changes: 5 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ ops.pebble module
ops.testing module
==================

.. automodule:: ops.testing
.. autoclass:: ops.testing.ActionFailed
.. autoclass:: ops.testing.ActionOutput
.. autoclass:: ops.testing.ExecArgs
.. autoclass:: ops.testing.ExecResult
.. autoclass:: ops.testing.Harness


Indices
Expand Down
Loading

0 comments on commit 7d3927a

Please sign in to comment.