Repository navigation
Conversation
…device_dtype_combinations` (scikit-learn#31074)" This reverts commit 6778690.
There was a problem hiding this comment.
LGTM.
While you are at it, maybe use the same id in the except ImportError clause a few lines below? I think right now they are roughly the same, but I guess it would be nice to use a more similar code so that the name of the test is the same whether the test is skipped or not.
|
So tests are failing because when we use scikit-learn/sklearn/utils/estimator_checks.py Lines 341 to 346 in e47b7c0 we yield a So I think we can amend all yield values in |
I'm okay with this. |
|
It seemed like a nice idea, but unfortunately the real world can be somewhat mean to nice ideas 😅, maybe it is better after all to forget about it? It feels like the status quo of having to remember to use
Tricky ... I think there is also an additional constraint that I don't think we want to have a hard dependency on pytest if you only import stuff from For example, scikit-learn/sklearn/utils/estimator_checks.py Lines 423 to 447 in 13e7ffb Not sure whether we are testing this thoroughly though because I would have expected a failure somewhere on this PR. I guess we don't have a build with both |
|
I hadn't thought about the import, that's a good point.
I added a scikit-learn/sklearn/utils/estimator_checks.py Lines 201 to 203 in ce8f23d we'd import pytest, so even without Happy to proceed either way. |
I would remove the Another other option is to a use a fixture: # conftest.py
# it's safe to use `pytest` features within `conftest.py`
def _yield_namespace_device_dtype_combinations_with_id():
for item in yield_namespace_device_dtype_combinations():
yield pytest.param(item, id=_get_id(item))
@pytest.fixture(params=_yield_namespace_device_dtype_combinations_with_id())
def namespace_device_case(request):
return request.param
# in test_*.py
def test_something(namespace_device_case):
array_namespace, device, dtype_name = namespace_device_case |
|
Could work I guess? But I mean, I would still be slightly in favour of the dumb option: copy around two lines instead of one each time I write an array api test 😅. There also seems to be an issue with our test for checking soft dependency on pytest but I am certainly not planning to look at it in the near future. |
I'm okay with copying everywhere as well. |
|
Thanks all. I am happy with the 'dumb' option too. I will close this and re-open the other PR. |
Reference Issues/PRs
yield_namespace_device_dtype_combinations#31074yield pytest.paramto set IDs as suggested by @thomasjpfan in DOC Add note about using_get_namespace_device_dtype_ids#31180Checked ID looks okay:
What does this implement/fix? Explain your changes.
Any other comments?
cc @lesteve @ogrisel