operator icon indicating copy to clipboard operation
operator copied to clipboard

Add detail/examples to "How to write unit tests" doc

Open dwilding opened this issue 4 months ago • 0 comments

Based on feedback internally, we should cover a couple more things in How to write unit tests for a charm:

  • What might a test look like for a machine charm? The doc already has an example of how to verify that config was written in a container. We could add a similar example for a machine charm, mocking pathops/pathlib functions as needed.

  • Mention how to run unit tests. The doc doesn't mention tox -e unit anywhere. Even though the doc is about writing tests, people expect to find out how to run tests too. How to write integration tests for a charm has a section called "Run your tests", which I think is good.

dwilding avatar Oct 27 '25 01:10 dwilding