Skip to content

MAINT: Check essential data functions #380

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mtsokol
Copy link
Contributor

@mtsokol mtsokol commented May 26, 2025

Hi @ev-br,

As discussed in #379, here's a PR that introduces has_setup_funcs mark.

I applied it to the first batch of tests that use .draw() calls, which underneath uses do_draw, so at least one of the asarray, isnan, reshape, zeros is used (which has_setup_funcs checks).

I still need to find all tests that use draw.

@mtsokol mtsokol force-pushed the essential-data-funcs branch from 1eca62a to d53aa9f Compare May 26, 2025 19:19
@mtsokol mtsokol force-pushed the essential-data-funcs branch from d53aa9f to 3945aa7 Compare May 26, 2025 19:20
@ev-br
Copy link
Member

ev-br commented May 28, 2025

This is a great start!

I think it's best to generalize it from the onset to address #51
Ideally, there's a decorator (or a specific pytest mark, whichever is easier) with arguments. Tentatively calling this decorator def require(*args: str),

@require('sin', 'zeros_like')
@given(....)
def test_func(...):
   ....

so this would skip the test unless xp.sin and xp.zeros_like are available.

Whether the list dependencies of draw (your essential_functions) should be automatically added or needs listed explicitly --- so that the above example is @require(draw_deps, 'sin', 'zeros_like') --- this can go both ways. I'd lean towards explicit is better than implicit, but it's a mild preference.

Also do you think it'd be useful to add a knob to turn the check off, say, with env variable? The reason is if a library does not implement anything at all, is the test suite all green (everything is skipped) or all red (nothing works).

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants