The GitHub Actions job "Lint" on tvm.git/main has succeeded.
Run started by GitHub user tlopex (triggered by tlopex).

Head commit for run:
933f537e9b41e3ade4b5cdd0b3edcf86e81ab9d7 / Tai An <[email protected]>
[S-TIR][Test] Use tvm.testing.main() so schedule tests can run standalone 
(#20283)

## Problem

Two files under `tests/python/s_tir/schedule/` cannot be run standalone.

### 1. `tvm.testing` is used but never imported

Both `test_tir_schedule_storage_align.py` and
`test_tir_schedule_read_write_at.py`
reference `tvm.testing` while importing only `import tvm`:

```python
import tvm
from tvm import tirx
```

`tvm/__init__.py` does not pull in `tvm.testing`, so the attribute only
resolves
because pytest has already imported the submodule elsewhere in the
session.
Running either file directly gives:

```
AttributeError: module 'tvm' has no attribute 'testing'
```

These are the only two files in the directory with that gap.

### 2. `test_tir_schedule_storage_align.py` has a broken `__main__`
block

```python
use_block_name = tvm.testing.parameter(by_dict={"block_obj": False, 
"block_name": True})

def test_storage_align(use_block_name):
    ...

if __name__ == "__main__":
    test_storage_align()          # <-- no argument for the fixture
    test_storage_align_update()
    ...
```

`test_storage_align` takes the parametrized `use_block_name` fixture, so
the
first line of the `__main__` block raises:

```
TypeError: test_storage_align() missing 1 required positional argument: 
'use_block_name'
```

The hand-maintained list is also stale-prone — it has to be updated by
hand
every time a test is added.

## Fix

Add the missing `import tvm.testing` to both files, and replace the
hand-written call list with `tvm.testing.main()`, which is what **36 of
the 39**
files in `tests/python/s_tir/schedule/` already do (including
`test_tir_schedule_read_write_at.py`) and which handles parametrized
tests
correctly.

Test behaviour under pytest is unchanged — this only affects direct
`python tests/python/s_tir/schedule/test_...py` invocation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: Tai An <[email protected]>

Report URL: https://github.com/apache/tvm/actions/runs/34185099813

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to