-
Notifications
You must be signed in to change notification settings - Fork 19
Closed
Labels
testingUnit tests and pytest configurationUnit tests and pytest configuration
Milestone
Description
Fixtures like these make the function less readable, have no actual benefit over normal functions (as in, they don't need session scope etc.)
Lines 28 to 57 in b3999df
| @pytest.fixture | |
| def load_channel(get_model: ModelFixture): | |
| def wrapper(preset: str, type: type[Channel] = Channel): | |
| return get_model(f"channels/{preset}", type) | |
| return wrapper | |
| @pytest.fixture | |
| def load_instrument(load_channel: ModelFixture): | |
| def wrapper(preset: str): | |
| return load_channel(preset, Instrument) | |
| return wrapper | |
| @pytest.fixture | |
| def load_layer(load_channel: Any): | |
| def wrapper(preset: str): | |
| return load_channel(preset, Layer) | |
| return wrapper | |
| @pytest.fixture | |
| def load_sampler(load_channel: Any): | |
| def wrapper(preset: str): | |
| return load_channel(preset, Sampler) | |
| return wrapper |
Additional type-hinting code is required as well to pass them as arguments to a test function:
Lines 22 to 25 in b3999df
| ChannelFixture = Callable[[str], Channel] | |
| InstrumentFixture = Callable[[str], Instrument] | |
| LayerFixture = Callable[[str], Layer] | |
| SamplerFixture = Callable[[str], Sampler] |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
testingUnit tests and pytest configurationUnit tests and pytest configuration