charmed-kubernetes / pytest-operator

Apache License 2.0
7 stars 13 forks source link

Improve .build_charm return type #141

Closed dimaqq closed 1 month ago

dimaqq commented 2 months ago

Currently build_charm returns Optional[Path] while the comment next to the return statement suggests that it return "one of built paths" (in case of multiple bases).

I suspect that returning None means an error or, alternatively, can never happen,

Meanwhile charm integration tests rely on this function to return a Path, e.g. like so:

      logger.info("Build charm locally")
      charm = await ops_test.build_charm(".")

      logger.info("Refresh the charm")
      await application.refresh(path=charm)

I'm proposing that if charm file cannot be found, this function raises an error, and the return type would be a (mandatory) Path.

addyess commented 1 month ago

Resolved with #142