forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[psuutil] Refactor to utilize sonic-platform package (sonic-net#1434)
#### What I did Refactor psuutil to use sonic-platform package in lieu of old, deprecated platform plugins. The psuutil utility is still useful, as psushow only reads and displays PSU data from State DB. However, this utility provides us the ability to read directly from the PSUs which is helpful for debugging. #### How I did it - Complete refactor to use sonic-platform package - Add more output columns to display (Model, Serial, Voltage, Current, Power) - Bump version to 2.0 - Add basic unit tests
- Loading branch information
Showing
2 changed files
with
105 additions
and
68 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import sys | ||
import os | ||
from unittest import mock | ||
|
||
import pytest | ||
from click.testing import CliRunner | ||
|
||
test_path = os.path.dirname(os.path.abspath(__file__)) | ||
modules_path = os.path.dirname(test_path) | ||
sys.path.insert(0, modules_path) | ||
|
||
sys.modules['sonic_platform'] = mock.MagicMock() | ||
import psuutil.main as psuutil | ||
|
||
|
||
class TestPsuutil(object): | ||
|
||
def test_version(self): | ||
runner = CliRunner() | ||
result = runner.invoke(psuutil.cli.commands['version'], []) | ||
assert result.output.rstrip() == 'psuutil version {}'.format(psuutil.VERSION) |