Update unit test requirements and add unit test to .github/workflows#2271
Update unit test requirements and add unit test to .github/workflows#2271p3ck wants to merge 2 commits into
Conversation
The last few commits to the eda plugins neglected to include the needed requirements to run the unit tests properly. We should update the github workflows to run the unit tests when any any changes are made to the extentions/eda directory.
There was a problem hiding this comment.
LGTM, thanks!
Validated locally with ansible-test units --docker -v.
Before:
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-8.4.2, pluggy-1.6.0
plugins: xdist-3.8.0, mock-3.15.1
12 workers [0 items]
==================================== ERRORS ====================================
_______ ERROR collecting tests/unit/event_source/test_azure_event_hub.py _______
tests/unit/event_source/test_azure_event_hub.py:7: in <module>
from extensions.eda.plugins.event_source.azure_event_hub import AzureHubConsumer, main
extensions/eda/plugins/event_source/azure_event_hub.py:14: in <module>
from azure.identity.aio import ClientSecretCredential
E ModuleNotFoundError: No module named 'azure.identity'
______ ERROR collecting tests/unit/event_source/test_azure_service_bus.py ______
'asyncio' not found in `markers` configuration option
... (12 occurrences, one per @pytest.mark.asyncio test)
============================== 13 errors in 1.76s ==============================
FATAL: ... returned exit status 1.After:
Successfully installed ... azure-identity-1.25.2 ... pytest-asyncio-1.4.0 ...
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-8.4.2, pluggy-1.6.0
plugins: asyncio-1.4.0, xdist-3.8.0, mock-3.15.1
asyncio: mode=Mode.STRICT
12 workers [17 items]
...
============================== 17 passed in 2.08s ==============================
Unit test controller with Python 3.13
============================== 17 passed in 2.00s ==============================
Unit test controller with Python 3.14
============================== 17 passed in 2.19s ==============================Side note: the PR description also mentions updating the GH workflows to trigger unit tests on changes under extensions/eda/, but I don't see that change in the diff — is that intended as a follow-up PR?
|
Adding unit tests to github workflows will come in a follow up PR. I'm still investigating the best way to implement it for this repo. |
|
I added the unit tests here which allowed me to verify that everyting working together |
| branches: | ||
| - main | ||
| - stable-4.x | ||
| - stable-5.x |
There was a problem hiding this comment.
The main branch does not exist in this repo. This repo use dev branch as "main". And also no stable-* branches.
| # - stable-2.15 | ||
| # - stable-2.16 | ||
| # - stable-2.17 | ||
| # - stable-2.18 |
There was a problem hiding this comment.
The file pr-pipelines.yml still use 2.18. Could you add the 2.18 to align with the pr-pipelines.yml?
SUMMARY
The last few commits to the eda plugins neglected to include the needed requirements to run the unit tests properly.
We should update the github workflows to run the unit tests when any any changes are made to the extentions/eda directory.
ISSUE TYPE
COMPONENT NAME
Unit tests for extensions/eda
ADDITIONAL INFORMATION
To validate you can run:
ansible-test units --docker -v