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

Fix build issue: cannot import name FW_AUTO_ERR_UKNOWN- required module not found #9764

Merged
merged 1 commit into from
Jan 14, 2022

Conversation

Junchao-Mellanox
Copy link
Collaborator

Why I did it

PR sonic-net/sonic-platform-common#254 fixed a typo in sonic-platform-common, but it does not fix the same typo in Mellanox platform API. So it causes a build issue when updating sonic-platform-common submodule pointer.

==================================== ERRORS ====================================
2022-01-13T06:33:43.5047338Z ___________________ ERROR collecting tests/test_firmware.py ____________________
2022-01-13T06:33:43.5048665Z ImportError while importing test module '/sonic/platform/mellanox/mlnx-platform-api/tests/test_firmware.py'.
2022-01-13T06:33:43.5049454Z Hint: make sure your test modules/packages have valid Python names.
2022-01-13T06:33:43.5050210Z Traceback:
2022-01-13T06:33:43.5051411Z /usr/lib/python2.7/dist-packages/_pytest/python.py:450: in _importtestmodule
2022-01-13T06:33:43.5052148Z     mod = self.fspath.pyimport(ensuresyspath=importmode)
2022-01-13T06:33:43.5053548Z /usr/lib/python2.7/dist-packages/py/_path/local.py:668: in pyimport
2022-01-13T06:33:43.5054139Z     __import__(modname)
2022-01-13T06:33:43.5055087Z /usr/lib/python2.7/dist-packages/_pytest/assertion/rewrite.py:294: in load_module
2022-01-13T06:33:43.5055724Z     six.exec_(co, mod.__dict__)
2022-01-13T06:33:43.5056653Z /usr/lib/python2.7/dist-packages/six.py:709: in exec_
2022-01-13T06:33:43.5057242Z     exec("""exec _code_ in _globs_, _locs_""")
2022-01-13T06:33:43.5057736Z <string>:1: in <module>
2022-01-13T06:33:43.5058135Z     ???
2022-01-13T06:33:43.5058602Z tests/test_firmware.py:27: in <module>
2022-01-13T06:33:43.5059179Z     from sonic_platform.component import Component, ComponentSSD
2022-01-13T06:33:43.5060037Z sonic_platform/component.py:43: in <module>
2022-01-13T06:33:43.5061372Z     raise ImportError(str(e) + "- required module not found")
2022-01-13T06:33:43.5062563Z E   ImportError: cannot import name FW_AUTO_ERR_UKNOWN- required module not found
2022-01-13T06:33:43.5064027Z  generated xml file: /sonic/platform/mellanox/mlnx-platform-api/test-results.xml 

Actually this is kind of circuit dependency:

  1. If we fix the typo in platform API code while do not fix typo in sonic-platform-common, the platform API PR can never pass checker
  2. If we fix the typo in sonic-platform-common, the submodule pointer update PR can never pass checker

So this PR is just a workaround for this.

How I did it

Try to import the correct name first. If there is a import error, try to import the previous name.

How to verify it

Run build

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

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106

Description for the changelog

A picture of a cute animal (not mandatory but encouraged)

@prgeor prgeor merged commit ca36b4a into sonic-net:master Jan 14, 2022
@dgsudharsan dgsudharsan added the Request for 202111 Branch For PRs being requested for 202111 branch label Jan 14, 2022
@Junchao-Mellanox Junchao-Mellanox deleted the fix-import-issue branch January 17, 2022 01:13
judyjoseph pushed a commit that referenced this pull request Jan 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Included in 202111 Branch Request for 202111 Branch For PRs being requested for 202111 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants