Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Abandon test suite for loops for pytest best practices #16

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
Pevtrick merged 1 commit into sqids:main from kurtmckee:use-parameters-not-for-loops
Jul 30, 2024

Conversation

@kurtmckee
Copy link
Contributor

@kurtmckee kurtmckee commented Jul 30, 2024

for loops in the test suite have significant disadvantages. Among them: a single failing test input causes the entire test to fail, rather than failing the specific input combinations that can cause failure.

While pytest output can help identify the specific failure inputs in the for loop, the best practice is to use pytest.mark.parametrize; this allows pytest to handle each parameter independently.

This PR swaps out for loops in the test suite with pytest's pytest.mark.parametrize decorator.

@kurtmckee kurtmckee force-pushed the use-parameters-not-for-loops branch from 61f35ab to 02a681f Compare July 30, 2024 14:02
Copy link
Contributor Author

Rebased on main to (ideally) resolve the CI failures caused by the past ruff error.

Pevtrick and 4kimov reacted with thumbs up emoji

@Pevtrick Pevtrick merged commit 3d3dc32 into sqids:main Jul 30, 2024
@kurtmckee kurtmckee deleted the use-parameters-not-for-loops branch July 30, 2024 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /