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/setup.py
Joe LeVeque 58db2d53e3
[sonic-py-common] Add unit test framework (#5238)
**- Why I did it**

To install the framework for adding unit tests to the sonic-py-common package and report coverage.

** How I did it **

- Incorporate pytest and pytest-cov into sonic-py-common package build
- Updgrade version of 'mock' installed to version 3.0.5, the last version which supports Python 2. This fixes a bug where the file object returned from `mock_open()` was not iterable (see https://bugs.python.org/issue32933)
- Add support for Python 3 setuptools and pytest in sonic-slave-buster environment
- Add tests for `device_info.get_machine_info()` and `device_info.get_platform()` functions
- Also add a .gitignore in the root of the sonic-py-common directory, move all related ignores from main .gitignore file, and add ignores for files and dirs generated by pytest-cov
2020-08-24 10:35:22 -07:00

48 lines
1.1 KiB
Python

from setuptools import setup
dependencies = [
'natsort',
'pyyaml',
'swsssdk>=2.0.1',
]
high_performance_deps = [
'swsssdk[high_perf]>=2.0.1',
]
setup(
name='sonic-py-common',
version='1.0',
description='Common Python libraries for SONiC',
license='Apache 2.0',
author='SONiC Team',
author_email='linuxnetdev@microsoft.com',
url='https://github.com/Azure/SONiC',
maintainer='Joe LeVeque',
maintainer_email='jolevequ@microsoft.com',
install_requires=dependencies,
extras_require={
'high_perf': high_performance_deps,
},
packages=[
'sonic_py_common',
],
setup_requires= [
'pytest-runner'
],
tests_require=[
'pytest',
'mock==3.0.5' # For python 2. Version >=4.0.0 drops support for py2
],
classifiers=[
'Intended Audience :: Developers',
'Operating System :: Linux',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python',
],
keywords='SONiC sonic PYTHON python COMMON common',
test_suite = 'setup.get_test_suite'
)