-
Notifications
You must be signed in to change notification settings - Fork 23.8k
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
Refactored test_equals_none() function #78585
Conversation
Well, they may produce side effects. Have you checked that? What does the original commit say? |
Or maybe those lines are missing the |
@@ -69,10 +69,6 @@ def test_get_groups(self): | |||
|
|||
def test_equals_none(self): | |||
other = None | |||
self.hostA == other |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alikins can you recall what these were for?
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
@mattclay I'm puzzled why this is happening under Python 3.9-3.11: 00:53 ==================================== ERRORS ====================================
00:53 ______________ ERROR collecting test/units/inventory/test_host.py ______________
00:53 ImportError while importing test module '/root/ansible/test/units/inventory/test_host.py'.
00:53 Hint: make sure your test modules/packages have valid Python names.
00:53 Traceback:
00:53 /usr/lib/python3.10/importlib/__init__.py:126: in import_module
00:53 return _bootstrap._gcd_import(name[level:], package, level)
00:53 test/units/inventory/test_host.py:25: in <module>
00:53 from units.compat import unittest
00:53 E ModuleNotFoundError: No module named 'units' I've restarted the jobs but the change doesn't seem to be caused by this patch 🤔. |
Hi @webknjaz, as you probably saw the original commit #17827 for this test did not provide a reason for these equality statements, so I'm confused why these are here and causing the failed checks. I appreciate you looking into this issue. |
I'm actually not sure your changes are causing this. Which is why I tagged @mattclay, so we could get to the bottom of this in case it's If the changes were to cause this, my best guess is side effects caused by the dunder methods at https://github.com/ansible/ansible/blob/045f303/lib/ansible/inventory/host.py#L43. Although, I don't see anything that could actually cause a side effect there. |
@mattclay noticed that missing |
Sometimes pytest errors out with an `ImportError` during its tests collection stage when a Python package/directory containing the test module does not have an `__init__.py` in it. This is being observed under Python 3.9 and higher. The patch provides a workaround for this problem but does not address the root cause which is currently unknown. Ref: ansible#78585 (comment)
This will fix it #78592 |
Sometimes pytest errors out with an `ImportError` during its tests collection stage when a Python package/directory containing the test module does not have an `__init__.py` in it. This is being observed under Python 3.9 and higher. The patch provides a workaround for this problem but does not address the root cause which is currently unknown. Ref: #78585 (comment)
Sometimes pytest errors out with an `ImportError` during its tests collection stage when a Python package/directory containing the test module does not have an `__init__.py` in it. This is being observed under Python 3.9 and higher. The patch provides a workaround for this problem but does not address the root cause which is currently unknown. Ref: ansible#78585 (comment) (cherry picked from commit beb70da)
@alexwholland it's green now, but I'd still go for adding |
Sometimes pytest errors out with an `ImportError` during its tests collection stage when a Python package/directory containing the test module does not have an `__init__.py` in it. This is being observed under Python 3.9 and higher. The patch provides a workaround for this problem but does not address the root cause which is currently unknown. Ref: ansible#78585 (comment) (cherry picked from commit beb70da)
Sometimes pytest errors out with an `ImportError` during its tests collection stage when a Python package/directory containing the test module does not have an `__init__.py` in it. This is being observed under Python 3.9 and higher. The patch provides a workaround for this problem but does not address the root cause which is currently unknown. Ref: ansible#78585 (comment) (cherry picked from commit beb70da)
Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
Sometimes pytest errors out with an `ImportError` during its tests collection stage when a Python package/directory containing the test module does not have an `__init__.py` in it. This is being observed under Python 3.9 and higher. The patch provides a workaround for this problem but does not address the root cause which is currently unknown. Ref: #78585 (comment) (cherry picked from commit beb70da)
Sometimes pytest errors out with an `ImportError` during its tests collection stage when a Python package/directory containing the test module does not have an `__init__.py` in it. This is being observed under Python 3.9 and higher. The patch provides a workaround for this problem but does not address the root cause which is currently unknown. Ref: #78585 (comment) (cherry picked from commit beb70da)
Sometimes pytest errors out with an `ImportError` during its tests collection stage when a Python package/directory containing the test module does not have an `__init__.py` in it. This is being observed under Python 3.9 and higher. The patch provides a workaround for this problem but does not address the root cause which is currently unknown. Ref: #78585 (comment) (cherry picked from commit beb70da)
@alexwholland Thanks for submitting this PR. It looks like we forgot about this after the most recent changes were made. These fixes, along with other similar fixes, were merged as part of: #79940 |
SUMMARY
Removed equality statements in the
test_equals_none()
function since they are never used.ISSUE TYPE
COMPONENT NAME
test/units/inventory/test_host.py