Skip to content

refactor: move the content of ops.testing to ops._private.harness - #1369

Merged
tonyandrewmeyer merged 7 commits into
canonical:mainfrom
tonyandrewmeyer:move-harness
Sep 17, 2024
Merged

tonyandrewmeyer merged 7 commits into
canonical:mainfrom
tonyandrewmeyer:move-harness

Conversation

@tonyandrewmeyer

Copy link
Copy Markdown
Collaborator

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.

@tonyandrewmeyer

tonyandrewmeyer commented Sep 11, 2024

Copy link
Copy Markdown
Collaborator Author

PRs to stop charms using the private class:

@tonyandrewmeyer

tonyandrewmeyer commented Sep 11, 2024

Copy link
Copy Markdown
Collaborator Author

PRs to stop charms using the private class:

Unfortunately, these are not the only culprits, there's also:

My feeling is that by accessing a private name and not fixing that after the issue in ops was fixed, the charmers should take responsibility for fixing this themselves (it's fairly straightforward). However, if people want to argue that we should offer up PRs for the above as well, I can do that.

@benhoyt benhoyt 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.

Do you think you could rebase/redo this PR into two commits: one with a pure rename of ops/testing.py to ops/_private/harness.py, and one with any actual changes? Otherwise it's very difficult to see the actual changes.

Comment thread ops/testing.py Outdated
@tonyandrewmeyer
tonyandrewmeyer marked this pull request as ready for review September 12, 2024 04:47

@benhoyt benhoyt 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.

Looks straight-forward enough -- just a couple of questions for now.

Comment thread ops/testing.py Outdated
Comment thread ops/testing.py
)

# The Harness testing framework.
_ = ActionFailed

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.

What's the difference/advantage of doing this over __all__?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

__all__ causes Sphinx to get very confused, and I couldn't figure out any way to keep __all__ and de-confuse it.

Comment thread ops/testing.py

@benhoyt benhoyt 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.

Okay, I'm happy with the changes themselves, but I'm concerned about what this means for our API reference docs. It seems like PR means there are now no docs for ops.testing -- is that intentional? https://ops--1369.org.readthedocs.build/en/1369/#module-ops.testing

@tonyandrewmeyer

Copy link
Copy Markdown
Collaborator Author

Okay, I'm happy with the changes themselves, but I'm concerned about what this means for our API reference docs. It seems like PR means there are now no docs for ops.testing -- is that intentional?

No, when I checked what the docs were like I loaded the wrong file, so I missed this. I'll figure out how to fix it.

@benhoyt benhoyt 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.

Looks good to me, thanks!

@dimaqq

dimaqq commented Sep 17, 2024

Copy link
Copy Markdown
Contributor

pls rebase too

@tonyandrewmeyer
tonyandrewmeyer merged commit cae9cef into canonical:main Sep 17, 2024
@tonyandrewmeyer
tonyandrewmeyer deleted the move-harness branch September 17, 2024 22:03
tonyandrewmeyer added a commit to tonyandrewmeyer/operator that referenced this pull request Oct 4, 2024
…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.
orfeas-k added a commit to canonical/minio-operator that referenced this pull request Dec 10, 2024
orfeas-k added a commit to canonical/notebook-operators that referenced this pull request Dec 10, 2024
orfeas-k added a commit to canonical/minio-operator that referenced this pull request Dec 13, 2024
* Pin pip to 24.2 due to jazzband/pip-tools#2131
* Update python dependencies using 'tox -e update-requirements'
* Remove unused pytest-lazy-fixture package
* Remove mocking of private ops class according to canonical/operator#1369 and canonical/seldon-core-operator#268

Ref canonical/bundle-kubeflow#1177
Ref canonical/bundle-kubeflow#1185
orfeas-k added a commit to canonical/notebook-operators that referenced this pull request Dec 13, 2024
* Pin pip to 24.2 due to jazzband/pip-tools#2131
* Update python dependencies using 'tox -e update-requirements'
* Remove mocking of private ops class according to canonical/operator#1369 and canonical/seldon-core-operator#268
* Pin blinker due to seleniumbase/SeleniumBase#2782

Ref canonical/bundle-kubeflow#1177
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.

3 participants