Skip to content

Move test helpers#267

Merged
Intron7 merged 3 commits into
mainfrom
move-test-helpers
Sep 26, 2024
Merged

Move test helpers#267
Intron7 merged 3 commits into
mainfrom
move-test-helpers

Conversation

@flying-sheep

@flying-sheep flying-sheep commented Sep 26, 2024

Copy link
Copy Markdown
Member

Things in tests shouldn’t be imported.

An alternative would be to move all that code into conftest and define that parameter set as fixture:

@pytest.fixture(scope="session", params=ARRAY_TYPES_MEM)
def array_type_mem(request: pytest.FixtureRequest) -> Callable[[ArrayLike], csr_matrix | csc_matrix | np.ndarray]:
    return request.param

then you can just do

@pytest.mark.parametrize("metric", ["sum", "mean", "var", "count_nonzero"])
def test_aggregate_vs_pandas(metric, array_type_mem):
    ...

@Intron7 Intron7 merged commit b304535 into main Sep 26, 2024
@Intron7 Intron7 deleted the move-test-helpers branch September 26, 2024 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants