Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build_charm should return Path object #81

Closed
paulomach opened this issue Aug 24, 2023 · 2 comments · Fixed by #83
Closed

build_charm should return Path object #81

paulomach opened this issue Aug 24, 2023 · 2 comments · Fixed by #83

Comments

@paulomach
Copy link

Issue

pytest_operator.Ops_Test.build_charm return type is pathlib.Path
pytest_operator_cache.Ops_Test.build_charm return type is str

Tests relying on a charm with as Path object will fail on CI only.

@github-actions
Copy link

@carlcsaposs-canonical
Copy link
Contributor

Could you elaborate more on your use case?

ops_test.model.deploy from python-libjuju expects a str, not a path: https://github.com/juju/python-libjuju/blob/f21bc426952579efb980439f6a07d59bcb4cce0b/juju/model.py#L1670

python-libjuju contains a workaround for the non-conformant type signature in pytest-operator to cast the path to a string. However, it will fail to detect that the string is for a local charm (instead of a charm from charmhub) unless the path is resolved to an absolute path.

If possible, I'd prefer to avoid using this workaround since I'm worried it might introduce instabilities. I'd prefer to return a value that python-libjuju/juju expects—e.g. "./foo.charm" for a local charm.

However, if your use case requires a path, we should revisit this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants