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

Abandon test suite for loops for pytest best practices #16

Merged
merged 1 commit into from
Jul 30, 2024

Conversation

kurtmckee
Copy link
Contributor

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
@kurtmckee
Copy link
Contributor Author

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

@Pevtrick Pevtrick merged commit 3d3dc32 into sqids:main Jul 30, 2024
8 checks passed
@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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants