Skip to content

Enable ruff's flake8-pytest-style (PT) rules #2899

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

Merged
merged 9 commits into from
Dec 21, 2023
Merged

Enable ruff's flake8-pytest-style (PT) rules #2899

merged 9 commits into from
Dec 21, 2023

Conversation

seisman
Copy link
Member

@seisman seisman commented Dec 19, 2023

Enable ruff's flake8-pytest-style (PT) rules.

Currently, there are 6 rules that have violations:

ruff check pygmt doc/conf.py examples --extend-select=PT --statistics
164	PT023	[*] Use `@pytest.mark.mpl_image_compare()` over `@pytest.mark.mpl_image_compare`
  4	PT012	[ ] `pytest.raises()` block should contain a single simple statement
  3	PT004	[ ] Fixture `fixture_mock_x2sys_home` does not return anything, add leading underscore
  3	PT006	[*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple`
  2	PT017	[ ] Found assertion on exception `error` in `except` block, use `pytest.raises()` instead
  1	PT001	[*] Use `@pytest.fixture()` over `@pytest.fixture`

The first column is the number of violations for each rule.

Please check the ruff documentation for the explanations of each rule. I think I agree with all the rules except PT023. There are 164 violations and I'm OK with @pytest.mark.mpl_image_compare, so prefer to ignore this rule.

@seisman seisman added the maintenance Boring but important stuff for the core devs label Dec 19, 2023
@seisman seisman added this to the 0.11.0 milestone Dec 19, 2023
@seisman seisman marked this pull request as ready for review December 19, 2023 13:13
@seisman seisman changed the title RFC: Enable ruff's flake8-pytest-style (PT) rules Enable ruff's flake8-pytest-style (PT) rules Dec 19, 2023
@seisman seisman added the needs review This PR has higher priority and needs review. label Dec 20, 2023
@seisman seisman removed the needs review This PR has higher priority and needs review. label Dec 21, 2023
@seisman seisman merged commit a08a6cf into main Dec 21, 2023
@seisman seisman deleted the ruff/PT branch December 21, 2023 02:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Boring but important stuff for the core devs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant