Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Ruff rules PT for pytest style #332

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 3 commits into from
Mar 16, 2025
Merged

Conversation

cclauss
Copy link
Member

@cclauss cclauss commented Mar 8, 2025

Blocked by #333 or similar.

https://docs.astral.sh/ruff/rules/#flake8-pytest-style-pt

Python 3.x (3.13.2) on macOS-latest...

Before:
============================= 214 passed in 21.21s =============================

After:
============================= 221 passed in 21.00s =============================

Let's leave this a DRAFT pull request until after we add ruff format or similar (#333) to pre-commit because these transforms create very long lines (288 char) that must be formatted to fit in the 120 character per lint limit.

@cclauss cclauss force-pushed the ruff-rules-PT-for-pytest branch 3 times, most recently from a3ffabe to c4b285f Compare March 8, 2025 14:13
@aaronliu0130
Copy link
Member

aaronliu0130 commented Mar 8, 2025

Running black on this to solve the line length issues (while astral-sh/ruff#6936 won't be implemented in the near future) produced some interesting results: black.patch

Not entirely mergeable either since this also reformats the style of parameter indentation in function calls.

@cclauss
Copy link
Member Author

cclauss commented Mar 8, 2025

What is wrong with

reformats the style of parameter indentation in function calls.

as long as it is automatic and consistent with other Python codebases?

@aaronliu0130
Copy link
Member

aaronliu0130 commented Mar 8, 2025

It would be a new inconsistency introduced to our own codebase. We have to decide whether we want that, to which I’m neutral.

@aaronliu0130
Copy link
Member

aaronliu0130 commented Mar 10, 2025 via email

@aaronliu0130
Copy link
Member

On #317, which the unittest changes are blocking, I said:

That is still a draft, no? Do you want to me to replace your PR's unittest file with the black-formatted one I provided and then merge it?

If you don't object, I'll do that when I get home in 8 hours today.

@aaronliu0130
Copy link
Member

aaronliu0130 commented Mar 11, 2025

On second thought, I think I should implement the unittest dropping on the refactoring PR instead, since it's more topic-related and our branches conflict quite a bit (plus some of the changes here were already made in the refactoring branch).

@aaronliu0130
Copy link
Member

...that turned out to be an even worse idea since this PR does replace the asserts. I'll just do the black thing then.

@aaronliu0130
Copy link
Member

aaronliu0130 commented Mar 11, 2025

Do we need to do the setUp() and tearDown() for every little small test, as it is in with the run_around_tests() fixture rn? I feel like it'd do if these functions only run once every session.

@cclauss
Copy link
Member Author

cclauss commented Mar 11, 2025

Let’s put this PR on hold. It is still draft. We can merge #317 first.

@cclauss cclauss force-pushed the ruff-rules-PT-for-pytest branch 3 times, most recently from 68b0d33 to 9045069 Compare March 15, 2025 21:43
@aaronliu0130
Copy link
Member

Sorry, I didn't realize that you had reversed the changes removing unittest from unittests but also couldn't make a proposal as the relevant lines are outside the diff range. Treat my commit as you wish.

@cclauss cclauss force-pushed the ruff-rules-PT-for-pytest branch 7 times, most recently from fe04958 to 9a1934b Compare March 16, 2025 12:10
@cclauss cclauss marked this pull request as ready for review March 16, 2025 12:15
@cclauss cclauss requested a review from aaronliu0130 March 16, 2025 12:15
@cclauss cclauss changed the title DRAFT: Ruff rules PT for pytest style Ruff rules PT for pytest style Mar 16, 2025
@cclauss cclauss requested a review from jayvdb March 16, 2025 12:15
aaronliu0130
aaronliu0130 previously approved these changes Mar 16, 2025
@aaronliu0130 aaronliu0130 dismissed their stale review March 16, 2025 14:48

doesn't fix running with pytest

@cclauss cclauss force-pushed the ruff-rules-PT-for-pytest branch from 9a1934b to 81a65e6 Compare March 16, 2025 15:31
@cclauss
Copy link
Member Author

cclauss commented Mar 16, 2025

doesn't fix running with pytest

Local testing I do:
% python3 -m venv .venv
% source .venv/bin/activate
% python -m pip install --editable ".[dev]"
% pytest

python cpplint_clitest.py and python cpplint_unittest.py also work in an activated venv.

@aaronliu0130 aaronliu0130 merged commit 0391a42 into develop Mar 16, 2025
10 checks passed
@cclauss cclauss deleted the ruff-rules-PT-for-pytest branch March 17, 2025 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants