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 #816

Merged
merged 1 commit into from
Feb 8, 2024
Merged

Conversation

yikaiMeta
Copy link
Contributor

Summary:
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

This diff fixed it by mimicking D50647471.

Differential Revision: D53461157

@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 6, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D53461157

yikaiMeta added a commit to yikaiMeta/torchx that referenced this pull request Feb 6, 2024
Summary:

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

This diff fixed it by mimicking D50647471.

Reviewed By: ishachirimar

Differential Revision: D53461157
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D53461157

@yikaiMeta
Copy link
Contributor Author

test comment.

Copy link
Contributor Author

@yikaiMeta yikaiMeta left a comment

Choose a reason for hiding this comment

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

test comment.

Summary:

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

This diff fixed it by mimicking D50647471.

Reviewed By: ishachirimar

Differential Revision: D53461157
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D53461157

Copy link
Contributor

@Sanjay-Ganeshan Sanjay-Ganeshan left a comment

Choose a reason for hiding this comment

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

lgtm

@manav-a manav-a self-requested a review February 7, 2024 22:12
Copy link
Contributor

@manav-a manav-a left a comment

Choose a reason for hiding this comment

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

The changes look good. The failures are not associated with this change and are tests / changes that need to fixed.

@facebook-github-bot facebook-github-bot merged commit a2800d4 into pytorch:main Feb 8, 2024
18 of 24 checks passed
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. fb-exported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants