Commit 76efdf6
committed
cuda_bindings: compare explanation dicts to CUresult/cudaError_t __doc__
Add test_explanations_dict_matches_enum_member_docstrings, which checks that
each hand-maintained DRIVER_CU_RESULT_EXPLANATIONS and
RUNTIME_CUDA_ERROR_EXPLANATIONS entry matches the corresponding FastEnum
member's __doc__ (cuda-bindings 13.2+ is said to attach the same narrative text
via codegen).
The comparison uses strict string equality. In current releases the dict
text and __doc__ are not byte-identical: generated docstrings include Sphinx
cross-references (:py:obj:...) and manual line breaks where the dicts use raw
CUDA comment style (::symbol()) and single-line concatenation; some deprecated
codes differ in length. So the test is marked xfail(strict=False) so CI stays
green until dicts and generated docstrings share one source of truth; when they
align, XPASS indicates the xfail can be removed.
Skip the compare when cuda-bindings < 13.2 (major.minor). Skip members with
no __doc__ (e.g. cudaErrorApiFailureBase). Helpers: _explanation_text_from_dict_value
to flatten dict tuple fragments.
To inspect all mismatches locally: pytest --runxfail on this test.
Made-with: Cursor1 parent 07d522d commit 76efdf6
1 file changed
Lines changed: 72 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
16 | 21 | | |
17 | 22 | | |
18 | 23 | | |
| |||
22 | 27 | | |
23 | 28 | | |
24 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
25 | 97 | | |
26 | 98 | | |
27 | 99 | | |
| |||
0 commit comments