Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sonic-py-common] Add 'general' module with load_module_from_source() function #7167

Merged
merged 3 commits into from
Apr 8, 2021
Merged

[sonic-py-common] Add 'general' module with load_module_from_source() function #7167

merged 3 commits into from
Apr 8, 2021

Conversation

jleveque
Copy link
Contributor

@jleveque jleveque commented Mar 26, 2021

Why I did it

To eliminate the need to write duplicate code in order to import a Python module from a source file.

How I did it

Add general module to sonic-py-common, which contains a load_module_from_source() function which supports both Python 2 and 3.

Call this new function in:

  • sonic-ctrmgrd/tests/container_test.py
  • sonic-ctrmgrd/tests/ctrmgr_tools_test.py
  • sonic-host-services/tests/determine-reboot-cause_test.py
  • sonic-host-services/tests/hostcfgd/hostcfgd_test.py
  • sonic-host-services/tests/procdockerstatsd_test.py
  • sonic-py-common/sonic_py_common/daemon_base.py

How to verify it

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

  • 201811
  • 201911
  • 202006
  • 202012

@jleveque jleveque merged commit ee13837 into sonic-net:master Apr 8, 2021
@jleveque jleveque deleted the common_imp_src_py_function branch April 8, 2021 15:29
yxieca pushed a commit that referenced this pull request Apr 8, 2021
… function (#7167)

#### Why I did it

To eliminate the need to write duplicate code in order to import a Python module from a source file.

#### How I did it

Add `general` module to sonic-py-common, which contains a `load_module_from_source()` function which supports both Python 2 and 3.

Call this new function in:
- sonic-ctrmgrd/tests/container_test.py
- sonic-ctrmgrd/tests/ctrmgr_tools_test.py
- sonic-host-services/tests/determine-reboot-cause_test.py
- sonic-host-services/tests/hostcfgd/hostcfgd_test.py
- sonic-host-services/tests/procdockerstatsd_test.py
- sonic-py-common/sonic_py_common/daemon_base.py
raphaelt-nvidia pushed a commit to raphaelt-nvidia/sonic-buildimage that referenced this pull request May 23, 2021
… function (sonic-net#7167)

#### Why I did it

To eliminate the need to write duplicate code in order to import a Python module from a source file.

#### How I did it

Add `general` module to sonic-py-common, which contains a `load_module_from_source()` function which supports both Python 2 and 3.

Call this new function in:
- sonic-ctrmgrd/tests/container_test.py
- sonic-ctrmgrd/tests/ctrmgr_tools_test.py
- sonic-host-services/tests/determine-reboot-cause_test.py
- sonic-host-services/tests/hostcfgd/hostcfgd_test.py
- sonic-host-services/tests/procdockerstatsd_test.py
- sonic-py-common/sonic_py_common/daemon_base.py
carl-nokia pushed a commit to carl-nokia/sonic-buildimage that referenced this pull request Aug 7, 2021
… function (sonic-net#7167)

#### Why I did it

To eliminate the need to write duplicate code in order to import a Python module from a source file.

#### How I did it

Add `general` module to sonic-py-common, which contains a `load_module_from_source()` function which supports both Python 2 and 3.

Call this new function in:
- sonic-ctrmgrd/tests/container_test.py
- sonic-ctrmgrd/tests/ctrmgr_tools_test.py
- sonic-host-services/tests/determine-reboot-cause_test.py
- sonic-host-services/tests/hostcfgd/hostcfgd_test.py
- sonic-host-services/tests/procdockerstatsd_test.py
- sonic-py-common/sonic_py_common/daemon_base.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants