Anai-Guo opened a new pull request, #20326: URL: https://github.com/apache/tvm/pull/20326
Several relax/runtime test modules define the same test function name twice. The second `def` rebinds the module-level name, so pytest only collects the later one and the earlier test silently never runs. File-level `# ruff: noqa: F811` headers were hiding the lint signal (`ruff check --select F811 --ignore-noqa` shows them). | File | Duplicate | Fix | |---|---|---| | `relax/test_expr.py` | `test_match_cast` (two different tests) | Rename the second to `test_match_cast_json_roundtrip`. The restored first test still used the removed `MatchCast.pattern` field → switched to `b.ty.shape[i].same_as(m)`. | | `relax/test_ast_printer.py` | `test_shape_expr` (symbolic vars vs. constants) | Rename the first to `test_shape_expr_symbolic`. `ShapeExpr` now requires int64 values, so the vars are int64 and the expected printout is ``Expr(value=`m`)``. | | `runtime/test_runtime_nd_array.py` | `test_1d_view_of_first_half_of_1d_arr` | The second one uses `relative_byte_offset=512 * 4` → rename to `test_1d_view_of_second_half_of_1d_arr` (mirrors the existing 2d pair). | | `relax/test_transform_gradient_checkpoint.py` | `test_checkpoint_dag` | The **second** copy — the one pytest was collecting — is truncated: it builds the function but has no `Expected` module and no `assert_structural_equal`. Removed it so the full test runs. | | `relax/test_analysis.py` | `test_reshape_pattern_reject_reduction` | Byte-identical second copy removed. | | `relax/test_analysis_well_formed.py` | `test_incomplete_ty_must_be_consistent` | Byte-identical second copy removed. | F811 is dropped from the file-level noqa headers that no longer need it (otherwise `RUF100` fires). Left alone: `test_op_gradient_numeric.py::test_reshape` has the same issue, but it is LLVM-gated and I could not run it locally, so it is not included here. ### Testing CPU build of current `main` (ccd98e9, `USE_LLVM OFF`), `pytest` per file: | File | before | after | |---|---|---| | `relax/test_expr.py` | 31 passed | **32 passed** | | `relax/test_ast_printer.py` | 24 passed | **25 passed** | | `runtime/test_runtime_nd_array.py` | 14 passed | **15 passed** | | `relax/test_transform_gradient_checkpoint.py` | 11 passed | 11 passed (`test_checkpoint_dag` now includes the structural-equality check) | | `relax/test_analysis.py` | 37 passed | 37 passed | | `relax/test_analysis_well_formed.py` | 57 passed, 2 xfailed | 57 passed, 2 xfailed | Without the two small updates, the restored `test_match_cast` fails with `AttributeError: 'MatchCast' object has no attribute 'pattern'` and `test_shape_expr_symbolic` fails with `the value in ShapeType can only have dtype of int64`, i.e. both had drifted while hidden. `ruff check` / `ruff format --check` (v0.12.3, repo config) pass on all six files. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
