refactor: reduce the YAML loading and dumping in ops.testing #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Work-in-progress PR. Submit to upstream once it's more complete.
Changes:
It would be nice if we could avoid deserialising and writing the YAML files to the temporary charm directory. However, charms might be using those directly (I think we can say that they shouldn't for metadata.yaml, and probably actions.yaml - however CharmMeta does not currently load config.yaml, so it's legitimate to do that to get the defaults, for example). We could certainly cache the serialised form - we could perhaps symlink rather than write, but since the original form is possibly charmcraft.yaml, we'd need to write to one place, so that might not be a win. Biggest question is whether the charm tests actually need these files.
At the moment, timing is not necessarily a win:
upstream/scenario-7-migraine
)-e unit -- -s tests/unit/test_charm.py
)Once done, should resolve canonical#1498
There are some drive-by trailing whitespace fixes that come from running the pre-commit linting in the testing folder. Could move these out to a separate PR.
Similarly, shebangs are removed from files that aren't meant to be directly executed. Could move those out too.