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 warning B908(2) in api_test.py #821

Merged
merged 1 commit into from
Feb 13, 2024

Conversation

yikaiMeta
Copy link
Contributor

Fix the warning on the code:

B908: Contexts with exceptions assertions like with self.assertRaises or with pytest.raises should not have multiple top-level statements. Each statement should be in its own context. That way, the test ensures that the exception is raised only in the exact statement where you expect it. This warning is raised by flake8-bugbear: https://github.com/PyCQA/flake8-bugbear

Test plan:
auto tests from CI.

Fix the warning on the code:
B908: Contexts with exceptions assertions like with self.assertRaises or with pytest.raises should not have multiple top-level statements. Each statement should be in its own context. That way, the test ensures that the exception is raised only in the exact statement where you expect it.
This warning is raised by flake8-bugbear: https://github.com/PyCQA/flake8-bugbear
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 12, 2024
@facebook-github-bot
Copy link
Contributor

@yikaiMeta has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot facebook-github-bot merged commit 2845aec into pytorch:main Feb 13, 2024
18 of 24 checks passed
@yikaiMeta yikaiMeta deleted the patch-1 branch February 13, 2024 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants