Skip to content

driver/power/poe_netgear_plus: conditional import#1893

Open
Emantor wants to merge 1 commit into
labgrid-project:masterfrom
Emantor:topic/test-fixes
Open

driver/power/poe_netgear_plus: conditional import#1893
Emantor wants to merge 1 commit into
labgrid-project:masterfrom
Emantor:topic/test-fixes

Conversation

@Emantor

@Emantor Emantor commented Jun 10, 2026

Copy link
Copy Markdown
Member

Description
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'

Checklist

  • PR has been tested

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

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 46.0%. Comparing base (0507604) to head (cc340aa).
⚠️ Report is 8 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
labgrid/driver/power/poe_netgear_plus.py 0.0% 2 Missing ⚠️
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     
Flag Coverage Δ
3.10 46.0% <0.0%> (+<0.1%) ⬆️
3.11 46.0% <0.0%> (+<0.1%) ⬆️
3.12 46.0% <0.0%> (+<0.1%) ⬆️
3.13 45.9% <0.0%> (+<0.1%) ⬆️
3.14 45.9% <0.0%> (+<0.1%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant