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

Parametrization #1

Closed
ionelmc opened this issue Mar 3, 2016 · 8 comments
Closed

Parametrization #1

ionelmc opened this issue Mar 3, 2016 · 8 comments

Comments

@ionelmc
Copy link

ionelmc commented Mar 3, 2016

Building a bit on https://www.reddit.com/r/Python/comments/48qz7w/nox_virtualenvtest_automation_similar_to_tox_but/d0m3q4l, another way to handle parametrization is like this:

@nox.parametrize('python', ['/path/to/python2.7', '/path/to/python3.5', '/path/to/pypy', ...], ids=['py27', 'py34', 'pypy', ...])
@nox.parametrize('django', ['1.9', '1.8', ...])
def session_test(session, python, django):
   ...

This is quite identical to pytest parametrization.

The advantage over your initial proposal is that you can customize the display names (via ids).

Also, would be good to know how far and where you'd take nox. IOW, what goals does nox have?

PS. There is no contribution guide.

@theacodes
Copy link
Collaborator

Filed #2 for the contribution guide.

I'd definitely like to match py.test's parameterization as much as possible. I need to dig into how they implement it, but if you have any ideas I'd be happy to hear them.

Also, would be good to know how far and where you'd take nox. IOW, what goals does nox have?

I made nox to solve some pain points with a couple of projects where tox was unwieldy. I think a reasonable goal to start with is to have parity with tox with python configuration files instead of ini configuration files (and less 'magic'). But I'm 100% open to any feature suggestions.

@ionelmc
Copy link
Author

ionelmc commented Mar 3, 2016

Are you looking towards having 1:1 feature parity with tox? (all those weird options like use_develop, skip_sdist etc)

@theacodes
Copy link
Collaborator

I would say it's at a higher level than that. I don't necessary want a session.skip_sdist or session.use_develop option - I just want those things to be easily possible in nox. Those two, for example, already are possible as you're in complete control of whether or not to run pip install -e . or whatever.

@theacodes
Copy link
Collaborator

Okay, looks like the easiest way to do this is to just write a decorator that adds a calls attribute to the function, then have the loader expand those calls into individual test functions.

@theacodes
Copy link
Collaborator

@ionelmc how important is the ability to stack the decorator?

@theacodes
Copy link
Collaborator

Nevermind, I figured it out. :)

@ionelmc
Copy link
Author

ionelmc commented Mar 4, 2016

I usually need multi tier parametrization and I've used a configuration file and a template to generate tox.ini. It's not very pretty. You can see it here: https://github.com/ionelmc/python-manhole/blob/master/setup.cfg#L42-L94

The point is that this parametrization should allow multiple variables, make a product and allow the user to skip some of the combinations programmatically.

@theacodes
Copy link
Collaborator

Cool. I've got that worked out I just need to integrate the generated
functions with the session runner. Stay tuned. :)

On Fri, Mar 4, 2016, 1:04 AM Ionel Cristian Mărieș notifications@github.com
wrote:

I usually need multi tier parametrization and I've used a configuration
file and a template to generate tox.ini. It's not very pretty. You can
see it here:
https://github.com/ionelmc/python-manhole/blob/master/setup.cfg#L42-L94

The point is this parametrization should allow multiple variables, make a
product and allow the user to skip some of the combinations
programmatically.


Reply to this email directly or view it on GitHub
#1 (comment).

@theacodes theacodes mentioned this issue Mar 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants