Skip to content

assign None to platform_asic as default value when it not exist in test params#7606

Merged
XuChen-MSFT merged 1 commit intosonic-net:masterfrom
XuChen-MSFT:xuchen3/master/platform_asic-fetch-failure
Mar 1, 2023
Merged

assign None to platform_asic as default value when it not exist in test params#7606
XuChen-MSFT merged 1 commit intosonic-net:masterfrom
XuChen-MSFT:xuchen3/master/platform_asic-fetch-failure

Conversation

@XuChen-MSFT
Copy link
Copy Markdown
Contributor

Description of PR

Summary:
Fixes # (issue)

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Back port request

  • 201911
  • 202012
  • 202205

Approach

What is the motivation for this PR?

TunnelDscpToPgMapping test failure:

======================================================================
ERROR: sai_qos_tests.TunnelDscpToPgMapping

Traceback (most recent call last):
File "saitests/py3/sai_base_test.py", line 145, in setUp
ThriftInterface.setUp(self)
File "saitests/py3/sai_base_test.py", line 48, in setUp
self.platform_asic = self.test_params['platform_asic']
KeyError: 'platform_asic'


How did you do it?

assign None to platform_asic when it miss in test params

How did you verify/test it?

Any platform specific information?

Supported testbed topology if it's a new test case?

Documentation

Copy link
Copy Markdown
Collaborator

@StormLiangMS StormLiangMS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@XuChen-MSFT
Copy link
Copy Markdown
Contributor Author

/azp run Azure.sonic-mgmt

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@wangxin
Copy link
Copy Markdown
Collaborator

wangxin commented Mar 1, 2023

The pre-commit check detected issues in the files touched by this pull request.
The detected issues may be old or new. For new issues, please try to fix them.

For old issues, it is not mandatory to fix them because they were not caused by this change. It is unfair to blame
author of this pull request. But if you can take extra effort to fix the old issues as well, that would be great!

Detailed pre-commit check results:
trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
check yaml...........................................(no files to check)Skipped
check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

tests/saitests/py3/sai_base_test.py:33:1: E402 module level import not at top of file
tests/saitests/py3/sai_base_test.py:36:1: E302 expected 2 blank lines, found 1
tests/saitests/py3/sai_base_test.py:61:83: E225 missing whitespace around operator
tests/saitests/py3/sai_base_test.py:77:30: E711 comparison to None should be 'if cond is not None:'
tests/saitests/py3/sai_base_test.py:123:13: F631 assertion is always true, perhaps remove parentheses?
tests/saitests/py3/sai_base_test.py:123:121: E501 line too long (121 > 120 characters)
tests/saitests/py3/sai_base_test.py:124:93: E128 continuation line under-indented for visual indent
tests/saitests/py3/sai_base_test.py:127:5: E301 expected 1 blank line, found 0
tests/saitests/py3/sai_base_test.py:135:121: E501 line too long (123 > 120 characters)
tests/saitests/py3/sai_base_test.py:136:90: E128 continuation line under-indented for visual indent
tests/saitests/py3/sai_base_test.py:148:30: E711 comparison to None should be 'if cond is not None:'
...
[truncated extra lines, please run pre-commit locally to view full check results]

To run the pre-commit checks locally, you can follow below steps:

  1. Ensure that default python is python3. In sonic-mgmt docker container, default python is python2. You can run
    the check by activating the python3 virtual environment in sonic-mgmt docker container or outside of sonic-mgmt
    docker container.
  2. Ensure that the pre-commit package is installed:
sudo pip install pre-commit
  1. Go to repository root folder
  2. Install the pre-commit hooks:
pre-commit install
  1. Use pre-commit to check staged file:
pre-commit
  1. Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>

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