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

choosetests: return a NamedTuple (instead of a Tuple), to make it easier to add more information in the future #42723

Merged
merged 1 commit into from
Oct 21, 2021

Conversation

DilumAluthge
Copy link
Member

Currently, the choosetests function returns a Tuple.

This pull request modifies the choosetests function so that it returns a NamedTuple instead. With this change, if in the future we decide to add more return values, we can do so without breaking existing uses of the choosetets function.

@DilumAluthge DilumAluthge added the testsystem The unit testing framework and Test stdlib label Oct 20, 2021
@aviatesk
Copy link
Member

I suggest you switch to the config = choosetests(…) and config.tests pattern at every callsite. We also want to change the docstring accordingly.

@DilumAluthge
Copy link
Member Author

We also want to change the docstring accordingly.

Done!

@DilumAluthge
Copy link
Member Author

I suggest you switch to the config = choosetests(…) and config.tests pattern at every callsite. We also want to change the docstring accordingly.

Hmmm, any particular reason why? This seems like a lot of code churn. And the current form (tests, net_on, exit_on_error, use_revise, seed = choosetests(ARGS)) should continue to work fine, right?

@aviatesk
Copy link
Member

And the current form (tests, net_on, exit_on_error, use_revise, seed = choosetests(ARGS)) should continue to work fine, right?

yeah, but it also holds for the current Tuple return type: e.g. a, b = (1, 2, 3) # assume 3 is added later.
I thought the purpose of this PR is to stop splatting the return value at callsite (which requires us to understand the order of tuple), but rather use the computed options with explicit field access instead ?

@DilumAluthge
Copy link
Member Author

I thought the purpose of this PR is to stop splatting the return value at callsite (which requires us to understand the order of tuple), but rather use the computed options with explicit field access instead ?

Oh, I see what you're getting at. Yeah that was the purpose of this PR.

@DilumAluthge
Copy link
Member Author

What if we instead switch to destructuring the named tuple, i.e. (; tests, net_on, exit_on_error, use_revise, seed) = choosetests(ARGS)?

It's more concise. And as far as I can tell, this form does not require us to know about the order of the tuple, right?

…it easier to add more information in the future
@DilumAluthge DilumAluthge force-pushed the dpa/choosetests-return-namedtuple branch from 26b743b to 8b4b6f7 Compare October 21, 2021 06:01
@vtjnash vtjnash merged commit 9e3cfc0 into master Oct 21, 2021
@vtjnash vtjnash deleted the dpa/choosetests-return-namedtuple branch October 21, 2021 16:58
@vtjnash
Copy link
Member

vtjnash commented Oct 21, 2021

We'll probably still need to preserve the order in the future, but this will likely make it easier for folks to use, particularly for new additions

@DilumAluthge DilumAluthge added backport 1.6 Change should be backported to release-1.6 backport 1.7 ci Continuous integration labels Nov 7, 2021
KristofferC pushed a commit that referenced this pull request Nov 9, 2021
to make it easier to add more information in the future

(cherry picked from commit 9e3cfc0)
KristofferC pushed a commit that referenced this pull request Nov 10, 2021
to make it easier to add more information in the future

(cherry picked from commit 9e3cfc0)
@KristofferC KristofferC removed backport 1.6 Change should be backported to release-1.6 backport 1.7 labels Nov 13, 2021
daviehh pushed a commit to daviehh/julia that referenced this pull request Nov 16, 2021
to make it easier to add more information in the future

(cherry picked from commit 9e3cfc0)
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Feb 22, 2022
to make it easier to add more information in the future
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Mar 8, 2022
to make it easier to add more information in the future
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Continuous integration testsystem The unit testing framework and Test stdlib
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants