labgrid icon indicating copy to clipboard operation
labgrid copied to clipboard

driver/power/siglent: use backend function signatures expected by NetworkPowerDriver

Open Bastian-Krause opened this issue 2 years ago • 1 comments

Description When using the siglent power backend with the NetworkPowerDriver, this error occurs:

  self = NetworkPowerDriver(target=Target(name='Test', env=None), name='power', state=<BindingState.active: 2>, delay=2.0)

      @Driver.check_active
      @step()
      def off(self):
  >       self.backend.power_set(self._host, self._port, self.port.index, False)
  E       TypeError: power_set() takes 3 positional arguments but 4 were given

  labgrid/driver/powerdriver.py:219: TypeError

The siglent backend does not follow the function signatures expected by the NetworkPowerDriver, because it's missing the port parameter. Fix that by adding the port parameter and making sure that it's None, just like other backends do (apc, rest, sentry, simplerest, tplink).

Note: I have no Siglent device here to actually test this. I stumbled upon this while trying to add a test for another power-related change.

/cc @esben

Checklist

  • [ ] Tests for the feature
  • [ ] CHANGES.rst has been updated
  • [ ] PR has been tested

Fixes #717

Bastian-Krause avatar Aug 03 '22 12:08 Bastian-Krause

Codecov Report

Merging #960 (82ca4ab) into master (dffc61d) will decrease coverage by 0.0%. The diff coverage is 50.0%.

@@           Coverage Diff            @@
##           master    #960     +/-   ##
========================================
- Coverage    57.1%   57.1%   -0.1%     
========================================
  Files         150     150             
  Lines       11199   11201      +2     
========================================
  Hits         6402    6402             
- Misses       4797    4799      +2     
Impacted Files Coverage Δ
labgrid/driver/power/siglent.py 17.6% <50.0%> (-2.4%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update dffc61d...82ca4ab. Read the comment docs.

codecov[bot] avatar Aug 03 '22 12:08 codecov[bot]