Skip to content

Commit 8509f43

Browse files
authored
[thermalctld] Refactor to allow for greater unit test coverage; Add more unit tests (#157)
- Refactor thermalctld to reduce the amount of code in infinite loops, thus allowing us better unit test coverage - Refactor mock_platform.py such that it inherits from sonic-platform-common in order to ensure it is aligned with the current API definitions (this introduces a test-time dependency on the sonic-platform-common package) - Increase pytest verbosity to prevent truncation of error messages - Miscellaneous cleanup: - Fixes to grammar - Remove unnecessary punctuation from log messages - Increase overall unit test unit test coverage from 73% to 93%
1 parent 70f4e7b commit 8509f43

File tree

12 files changed

+1189
-542
lines changed

12 files changed

+1189
-542
lines changed

azure-pipelines.yml

+4
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,12 @@ jobs:
8181
set -xe
8282
sudo pip2 install swsssdk-2.0.1-py2-none-any.whl
8383
sudo pip2 install sonic_py_common-1.0-py2-none-any.whl
84+
sudo pip2 install sonic_config_engine-1.0-py2-none-any.whl
85+
sudo pip2 install sonic_platform_common-1.0-py2-none-any.whl
8486
sudo pip3 install swsssdk-2.0.1-py3-none-any.whl
8587
sudo pip3 install sonic_py_common-1.0-py3-none-any.whl
88+
sudo pip3 install sonic_config_engine-1.0-py3-none-any.whl
89+
sudo pip3 install sonic_platform_common-1.0-py3-none-any.whl
8690
workingDirectory: $(Pipeline.Workspace)/target/python-wheels/
8791
displayName: 'Install Python dependencies'
8892

sonic-thermalctld/pytest.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[pytest]
2-
addopts = --cov=scripts --cov-report html --cov-report term --cov-report xml --junitxml=test-results.xml -v
2+
addopts = --cov=scripts --cov-report html --cov-report term --cov-report xml --junitxml=test-results.xml -vv

sonic-thermalctld/scripts/thermalctld

+180-146
Large diffs are not rendered by default.

sonic-thermalctld/setup.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
tests_require=[
2424
'mock>=2.0.0; python_version < "3.3"',
2525
'pytest',
26-
'pytest-cov'
26+
'pytest-cov',
27+
'sonic-platform-common'
2728
],
2829
classifiers=[
2930
'Development Status :: 4 - Beta',

0 commit comments

Comments
 (0)