driver/power/poe_netgear_plus: conditional import#1893
Open
Emantor wants to merge 1 commit into
Open
Conversation
Conditionally import the NetgearSwitchConnector only once power_set and
power_get are used, fixes failing tests when the module is not
available:
__________________ ERROR collecting tests/test_powerdriver.py __________________
ImportError while importing test module '/build/source/tests/test_powerdriver.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/nix/store/60m4rxhg2fldqaak400c0lry96ijrzqn-python3-3.13.13/lib/python3.13/importlib/__init__.py:88: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests/test_powerdriver.py:6: in <module>
from labgrid.driver.power.poe_netgear_plus import _get_hostname_and_password
labgrid/driver/power/poe_netgear_plus.py:24: in <module>
from py_netgear_plus import NetgearSwitchConnector
E ModuleNotFoundError: No module named 'py_netgear_plus'
Signed-off-by: Rouven Czerwinski <rouven.czerwinski@linaro.org>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1893 +/- ##
======================================
Coverage 46.0% 46.0%
======================================
Files 180 180
Lines 14464 14472 +8
======================================
+ Hits 6654 6661 +7
- Misses 7810 7811 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Conditionally import the NetgearSwitchConnector only once power_set and power_get are used, fixes failing tests when the module is not available:
Checklist