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

[unit test] Move to a single framework: pytest and update secret mocking #188

Open
phvalguima opened this issue Feb 20, 2024 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@phvalguima
Copy link
Contributor

phvalguima commented Feb 20, 2024

We are using unittest as our main framework currently. However, as we move to data platform workflows, we can get a lot of advantages moving it to pytest instead.

One important point raised by @carlcsaposs-canonical is how can we parametrize juju versions for secret management:
https://github.com/canonical/mysql-router-k8s-operator/blob/f2cbb11ba9c333563acbb9f9b1e159adbded15b6/tests/unit/conftest.py#L60-L63

When testing it with OpenSearch, I've got the following errors:

_________________________________________________________________________________ ERROR at setup of TestOpenSearchInternalData.test_data_has_0_app _________________________________________________________________________________
test_data_has_0_app does not support fixtures, maybe unittest.TestCase subclass?
Node id: tests/unit/lib/test_opensearch_secrets.py::TestOpenSearchInternalData::test_data_has_0_app
Function type: TestCaseFunction

Also, we must remove dependency: parameterized and unify it under pytest.mark.parametrize.

@phvalguima phvalguima added the bug Something isn't working label Feb 20, 2024
Copy link
Contributor

@carlcsaposs-canonical
Copy link
Contributor

Choice of unittest/pytest for unit tests, to me, seems independent of data-platform-workflows

For unit tests, data-platform-workflows doesn't care if unittest/pytest is used

(For integration tests, pytest works better with dpw. And, imo, there's value in having the same framework for unit & integration tests)

@phvalguima phvalguima added enhancement New feature or request and removed bug Something isn't working labels Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants