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

Support passing a matrix to parametrize #2171

Closed
goodboy opened this issue Jan 3, 2017 · 9 comments
Closed

Support passing a matrix to parametrize #2171

goodboy opened this issue Jan 3, 2017 · 9 comments
Labels
status: needs information reporter needs to provide more information; can be closed after 2 or more weeks of inactivity topic: parametrize related to @pytest.mark.parametrize type: enhancement new feature or API change, should be merged into features branch

Comments

@goodboy
Copy link

goodboy commented Jan 3, 2017

This is just an idea.

parametrize() accepts a list of N-tuples to it's argvalues argument. This in turn generates a set of tests from the Cartesian product of the paired tuple's elements.

I propose that support is added to allow argvalues to be a matrix (the underlying data structures are up for debate) generated by the user.
This optionally allows for a user to generate tests only for the pairs of data they are interested in instead of having to filter down from the set of all pairs in pytest_modify_collectitems().

Of course the requirement on argvalues is that it must be a MxN matrix where argnames is of length N.

@nicoddemus
Copy link
Member

This in turn generates a set of tests from the Cartesian product of the paired tuple's elements.

A Cartesian product of the argument values is only generated when using multiple parametrize calls, otherwise only the tuples specified in the call are used for parametrization.

Sorry if it is obvious (I should have gone to bed by now), perhaps you can post an example to clarify what you mean?

@goodboy
Copy link
Author

goodboy commented Jan 4, 2017

@nicoddemus Let me drum up a test and I'll get back to you.
I may have gotten this wrong when I last was dealing with this problem.

@RonnyPfannschmidt
Copy link
Member

@tgoodlet sup on this one, can we close?

@goodboy
Copy link
Author

goodboy commented Jan 18, 2017

@RonnyPfannschmidt i'm pretty sure i found a bug with this so if you don't mind can we keep it open until i re-examine?

@nicoddemus
Copy link
Member

@tgoodlet gentle ping. 😁

@nicoddemus nicoddemus added topic: parametrize related to @pytest.mark.parametrize type: enhancement new feature or API change, should be merged into features branch labels Sep 28, 2017
@goodboy
Copy link
Author

goodboy commented Oct 9, 2017

@nicoddemus finally back and yes will try to take a look this week!

@RonnyPfannschmidt RonnyPfannschmidt added the status: needs information reporter needs to provide more information; can be closed after 2 or more weeks of inactivity label Oct 10, 2017
@nicoddemus
Copy link
Member

Cool, let us know if you need help. 👍

@nicoddemus
Copy link
Member

@tgoodlet should we close this for now? We can re-open this later when you get the time, no worries.

@goodboy
Copy link
Author

goodboy commented Jan 21, 2018

@nicoddemus yeah close it if it it helps with your checklists.
I'm way down a different rabbit hole atm and probably won't get back to this in the near term.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs information reporter needs to provide more information; can be closed after 2 or more weeks of inactivity topic: parametrize related to @pytest.mark.parametrize type: enhancement new feature or API change, should be merged into features branch
Projects
None yet
Development

No branches or pull requests

3 participants