boxed/hammett

Parametrized fixture support?

Opened this issue · 3 comments

Hi thanks for the project,

I would like to give it a try in my open source projects.

I tend to use parametrized fixtures in it. For example, https://github.com/proofit404/stories/blob/100755889b5478ee211852b78b8167a490e187c2/tests/helpers/examples/__init__.py#L41-L43

I saw parametrized decorator support already existed in the hammett.

Maybe it would be relatively simple to add parametrization to fixtures?

I could try to provide a pull request for it if you want this feature to be in the project.

Have a wonderful day 🌴

Best regards,
Artem.

boxed commented

I do want this feature yes. I think I looked at it once and gave up because I didn't have the time just then. But since then I rebuilt the fixture injection code, so it might be easier now.

I would love a PR. Especially some good comprehensive tests, like parametrized fixtures for one test, and then two parametrized fixtures that combine on one test, and a test to check that they combine properly with a parametrized test. I guess that's most of the gnarly cases...

I would try to lean the code base at first to understand the steps I need to take for the pull request.

Do you have any suggestions before I start?

boxed commented

Nothing super helpful. I have a short memory so I feel a bit like I'm learning the code base every time I go into it :P

There are some places that seem good to start though:

https://github.com/boxed/hammett/blob/master/hammett/impl.py#L72
https://github.com/boxed/hammett/blob/master/hammett/impl.py#L133
https://github.com/boxed/hammett/blob/master/hammett/impl.py#L163
https://github.com/boxed/hammett/blob/master/hammett/impl.py#L195