Skip to content

Update unit test requirements and add unit test to .github/workflows#2271

Open
p3ck wants to merge 2 commits into
ansible-collections:devfrom
p3ck:unit_requirements
Open

Update unit test requirements and add unit test to .github/workflows#2271
p3ck wants to merge 2 commits into
ansible-collections:devfrom
p3ck:unit_requirements

Conversation

@p3ck

@p3ck p3ck commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator
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
  • Bugfix Pull Request
COMPONENT NAME

Unit tests for extensions/eda

ADDITIONAL INFORMATION

To validate you can run:

ansible-test units --docker -v

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.
@p3ck p3ck requested a review from zunyangc June 4, 2026 19:50
zunyangc
zunyangc previously approved these changes Jun 5, 2026

@zunyangc zunyangc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@p3ck

p3ck commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator Author

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.

@zunyangc zunyangc added the ready-for-review The PR is ready to be reviewed and merged. label Jun 7, 2026
@zunyangc zunyangc requested a review from Vieran June 7, 2026 06:39
@p3ck

p3ck commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator Author

I added the unit tests here which allowed me to verify that everyting working together

@zunyangc zunyangc changed the title Update unit test requirements Update unit test requirements and add unit test to .github/workflows Jun 9, 2026
branches:
- main
- stable-4.x
- stable-5.x

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file pr-pipelines.yml still use 2.18. Could you add the 2.18 to align with the pr-pipelines.yml?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review The PR is ready to be reviewed and merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants