This repository has been archived on 2025-03-20. You can view files and clone it, but cannot push or open issues or pull requests.
sonic-buildimage/src/sonic-py-common/tests
Joe LeVeque b7344e8ac3 [sonic-py-common] Clear environment variables before running device_info tests (#7273)
#### Why I did it

To ensure any environment variables which are configured in the build/test environment do not influence the behavior of sonic-py-common during unit tests. For example, variables which might be set by continuous integration pipelines.

#### How I did it

Add class-scoped pytest fixture to `TestDeviceInfo` class which stashes the current environment variables, clears them and yields. Once all the test cases in the class finish, the fixture will restore the original environment variables.

Also remove unnecessary unittest-style setup and teardown functions from interface_test.py
2021-06-29 07:19:46 +00:00
..
__init__.py [sonic-py-common] Add unit test framework (#5238) 2020-08-24 10:35:22 -07:00
device_info_test.py [sonic-py-common] Clear environment variables before running device_info tests (#7273) 2021-06-29 07:19:46 +00:00
interface_test.py [sonic-py-common] Clear environment variables before running device_info tests (#7273) 2021-06-29 07:19:46 +00:00