smarie / python-pytest-harvest

Store data created during your `pytest` tests execution, and retrieve it at the end of the session, e.g. for applicative benchmarking purposes.
https://smarie.github.io/python-pytest-harvest/
BSD 3-Clause "New" or "Revised" License
62 stars 9 forks source link

Ability to save something else than the fixture in `@saved_fixture` #21

Closed smarie closed 5 years ago

smarie commented 5 years ago

Sometimes one would just like to save some attributes of the fixture, not the fixture itself.

For example if the fixture is a dataset, one would like to save its name, or various attributes (size, etc.), but probably not the full dataset itself.

To support this use case I suggest to add a views parameter to @saved_fixture. That parameter would contain a dictionary of {<key>: <procedure>}. For each entry, <procedure> will be applied on the fixture instance, and the result will be stored under <key>.