LouisDesdoigts / dLux

Differentiable optical models as parameterised neural networks in Jax using Zodiax
https://louisdesdoigts.github.io/dLux/
BSD 3-Clause "New" or "Revised" License
52 stars 6 forks source link

Depreciate `Utitlity` for `pytest.fixture`. #144

Closed Jordan-Dennis closed 1 year ago

Jordan-Dennis commented 1 year ago

The pytest fixture allows one to define utilities without the baggage that I created. The basic syntax for use is:

import pytest

@pytest.fixture
def example_dLux_layer():
    # Construct a layer here.
    return layer

def test_dLux_layer(fixture: callable) -> None:
    layer: Layer = fixture
    # Do tests
LouisDesdoigts commented 1 year ago

This looks like it would be better in the long run. I would probably leave this for now and we can dev it on a separate branch after the Apertures merge, unless you're already using it on that branch in which case we should do the whole thing on there - Thoughts?

Jordan-Dennis commented 1 year ago

I think this will be quick. The syntax is nearly the same, so I might make it part of the apertures pull request.

LouisDesdoigts commented 1 year ago

Yep cool, am on board with this

ataras2 commented 1 year ago

Agreed with changing now for apertures tests too

Jordan-Dennis commented 1 year ago

This is more involved than I thought. @ataras2 have you got parameters passing into fixtures yet?

Jordan-Dennis commented 1 year ago

pytest has some pretty lit features actually. For example, you can run tests using -k to search for keywords.

pytest -k "CartesianWavefront" tests/test_wavefronts.py

Source: pytest