Skip to content

[eeprom] Add UT for eeprom_tlvinfo.py#292

Merged
sujinmkang merged 6 commits intosonic-net:masterfrom
keboliu:eeprom_ut
Jul 16, 2022
Merged

[eeprom] Add UT for eeprom_tlvinfo.py#292
sujinmkang merged 6 commits intosonic-net:masterfrom
keboliu:eeprom_ut

Conversation

@keboliu
Copy link
Collaborator

@keboliu keboliu commented Jul 14, 2022

Description

Add unit test cases to test eeprom_tlvinfo.py, now code coverage is 80%

Motivation and Context

There is no UT available for eeprom_tlvinfo.py previously.
Using a HEX file to mock EEPROM content. Take this mocked EEPROM as input and test the functions.

How Has This Been Tested?

sonic@sonic_slave_docker:/sonic/src/sonic-platform-common/tests$ pytest-3 eeprom_base_test.py
=========================================================================================== test session starts ============================================================================================
platform linux -- Python 3.9.2, pytest-6.0.2, py-1.10.0, pluggy-0.13.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /sonic/src/sonic-platform-common-kebo, configfile: pytest.ini
plugins: pyfakefs-4.5.6, cov-2.10.1
collected 5 items                                                                                                                                                                                          

eeprom_base_test.py::TestEepromTlvinfo::test_eeprom_tlvinfo_read_api PASSED                                                                                                                          [ 20%]
eeprom_base_test.py::TestEepromTlvinfo::test_eeprom_tlvinfo_get_tlv_field PASSED                                                                                                                     [ 40%]
eeprom_base_test.py::TestEepromTlvinfo::test_eeprom_tlvinfo_set_eeprom PASSED                                                                                                                        [ 60%]
eeprom_base_test.py::TestEepromTlvinfo::test_eeprom_tlvinfo_update_eeprom_db PASSED                                                                                                                  [ 80%]
eeprom_base_test.py::TestEepromTlvinfo::test_eeprom_tlvinfo_read_eeprom_db PASSED   

Additional Information (Optional)

@keboliu keboliu requested a review from sujinmkang July 14, 2022 05:46
@sujinmkang sujinmkang merged commit 50c24a5 into sonic-net:master Jul 16, 2022
@keboliu keboliu deleted the eeprom_ut branch July 18, 2022 01:47
oleksandrivantsiv pushed a commit to oleksandrivantsiv/sonic-platform-common that referenced this pull request Oct 25, 2024
#### Why I did it
sonic-swss-common lib will add dependency to libyang soon, so need install libyang lib to prevent build and UT break.

#### How I did it
Modify azure pipeline to install libyang in azure pipeline steps.

#### How to verify it
Pass all UT.

#### Which release branch to backport (provide reason below if selected)

#### Description for the changelog
Modify azure pipeline to install libyang in azure pipeline steps.

#### Link to config_db schema for YANG module changes

#### A picture of a cute animal (not mandatory but encouraged)
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.

2 participants