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

Remove test constructors or mark as TestOnly #5216

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bentsherman
Copy link
Member

Fell down a rabbit hole while working on #5045 . Trying to remove test constructors where it's easy to do so, otherwise mark them as TestOnly. Would be good to get rid of them over time as they suggest to me that a class isn't easily testable.

@bentsherman bentsherman requested a review from pditommaso August 9, 2024 16:44
Copy link

netlify bot commented Aug 9, 2024

Deploy Preview for nextflow-docs-staging canceled.

Name Link
🔨 Latest commit f266bcf
🔍 Latest deploy log https://app.netlify.com/sites/nextflow-docs-staging/deploys/678faba73111430007b411ea

@bentsherman
Copy link
Member Author

@pditommaso do these changes look reasonable to you

@pditommaso
Copy link
Member

@TestOnly is a nice way to mark those constructors, but why it requires changing so many tests? also seems there are some changes in charliecloud that looks unrelated.

@bentsherman
Copy link
Member Author

I think I tried to remove test constructors in favor of using the real constructors as much as possible, where it didn't require too many changes to tests.

I think there was some issue recently where a test didn't catch a bug because it was using a test constructor and wasn't testing the behavior correctly. For this reason the test constructors seem like an anti-pattern, but in many cases they are convenient and it would be a hassle to remove them. So I just marked those with @testonly so that at least they are easier to track.

As for charliecloud, as far as I can tell that removed code is never used because registry is never set. I guess it's not related but I stumbled across it while making this PR.

@bentsherman bentsherman changed the title Mark test constructors as TestOnly or remove Remove test constructors or mark as TestOnly Dec 10, 2024
@pditommaso pditommaso force-pushed the master branch 2 times, most recently from 5a93547 to 27345a6 Compare February 10, 2025 21:46
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