Skip to content

test(functional): replace len() calls with list membership checks #2118

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 1 commit into from
Jul 4, 2022

Conversation

nejch
Copy link
Member

@nejch nejch commented Jul 3, 2022

See #1784 (comment).

I've felt a bit weird for a while about having these magic numbers in tests, and they don't really test whether the actual resource created is or isn't in the list. This should hopefully also help with some of the race conditions potentially introduced with async gitlab operations.

I've left a few where it would need some further refactoring (e.g. fixture factories for group/member creation) or where I thought len() was still useful. It was already quite tedious so it might be tedious to review, I can split it into multiple commits if needed :)

@nejch nejch marked this pull request as ready for review July 3, 2022 22:17
@nejch nejch requested a review from JohnVillalovos July 3, 2022 22:17
Copy link
Member

@JohnVillalovos JohnVillalovos left a comment

Choose a reason for hiding this comment

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

@nejch Wow! A lot of work there. Thanks!

Great idea.

@JohnVillalovos JohnVillalovos merged commit 97e0eb9 into main Jul 4, 2022
@JohnVillalovos JohnVillalovos deleted the test/no-len-asserts branch July 4, 2022 01:33
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