-
Notifications
You must be signed in to change notification settings - Fork 45
Providing reproduction code for failed test cases #379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks @mtsokol ! This is a great idea.
|
I can take a look at the tests that I've fixed in the past and provide a few more next week!
In When |
Thanks! I'd be very helpful.
That's a good point. Not much we can do about it at the array-api-tests level though. |
Would it make sense to require |
You mean add a note to this effect to the "Interpreting errors" section of the README? As a usability check: would this be useful to you when you had a issues with |
Yes, I think a note listing which functions are essential to run most of the test suite would be useful.
Here I think my answer is also "yes", but I'm not sure how it would impact execution time checking it for each test, and that's a bit noisy change for the repository: ESSENTIAL_FUNCS_MISSING = any(not hasattr(xp, name) for name in ["reshape", "asarray", "zeros", "isnan"])
ensure_essentials = pytest.mark.skipif(
ESSENTIAL_FUNCS_MISSING,
reason="Essential function are missing from the namespace: ...",
)
# in all relevant files:
@ensure_essentials
def test_function(): ... |
As long as it's a couple of Basically, what you talk about is #51 --- and if we do it, then each test should get its decorator with the actual list of its dependencies. OTOH, if the main pain point is with the hidden dependencies of |
Hi all!
Here's one idea on how to potentially improve interacting with failing tests in
array-api-tests
suite which @ev-br and I discussed this week.I've been involved in the introduction of
array-api-tests
suite in a few repositories and, from my personal experience, the activity that took the most of the time was figuring out root causes of failed tests.Each failure shows the stack trace (or multiple stack traces, if there were e.g. 3 distinct failures for a given test), but at times they are merely related to the actual root cause. For instance, in NumPy we have an
xfail
:which originally was reported by the test suite with an error:
I had to manually recreate the function call with the exact inputs to understand which edge case we hit. And for each test the error message was either accurate, like missing keyword argument, or irrelevant - which was mostly related to array scalars, Python builtins, or 0-D arrays as inputs or outputs.
From my point of view, one possible improvement of this process could be something like a CLI option
--with-repro-snippets
, where each failing test is accompanied by a copy-paste line that exactly reproduces it.So for
test_repeat
I would get:The
array-api-tests
suite would compose it withf"xp.{func_name}({inputs}, {kwargs})"
when a function call fails.This way, when I run a test suite for the first time and get e.g. 50 failures, I can iterate a bit faster by skipping the "reproduce failing code snippet" step. WDYT? Please share your thoughts!
More of a nitpick but some Array API functions are used in multiple tests, like
reshape
. I think it’s used primarily for setting up inputs for tests. When that one function is missing from the namespace, a large part of the test suite fails with more cryptic error messages. I think that there could be ahasattr(xp, "reshape")
decorator for tests and if a function for setting inputs is missing, the error says so.The text was updated successfully, but these errors were encountered: