Skip to content

inductor tests metaprogramming breaks for SLOW_TESTS logic #98954

@wconstab

Description

@wconstab

🐛 Describe the bug

Set up the slow tests file that CI would have, which names a particular inductor-dynamic test as slow and opts it into special handling
cd pytorch/test
echo "{"test_linear_packed_cpu_dynamic_shapes_cpp_wrapper (__main__.DynamicShapesCppWrapperCpuTests)": 66.40046428571428}" > .pytorch-slow-tests.json

Run the testrunner in a way that skips fast tests and runs slow tests

CI=1
export PYTORCH_TEST_WITH_SLOW=1
export PYTORCH_TEST_SKIP_FAST=1
python -bb inductor/test_torchinductor_dynamic_shapes.py -v --use-pytest -vv -rfEX -p no:xdist -x  --sw --import-slow-tests --import-disabled-tests -k test_linear_packed_cpu_dynamic_shapes_cpp_wrapper

Observe the following exception:

________ DynamicShapesCppWrapperCpuTests.test_linear_packed_cpu_dynamic_shapes_cpp_wrapper _________
Traceback (most recent call last):
  File "/scratch/whc/work/pytorch/test/inductor/test_cpp_wrapper.py", line 54, in fn
    tests.setUp()
  File "/scratch/whc/work/pytorch/test/inductor/test_torchinductor.py", line 159, in setUp
    super().setUp()
  File "/scratch/whc/work/pytorch/torch/testing/_internal/common_utils.py", line 2292, in setUp
    check_if_enable(self)
  File "/scratch/whc/work/pytorch/torch/testing/_internal/common_utils.py", line 1804, in check_if_enable
    _meth = getattr(test, test._testMethodName)
AttributeError: 'CpuTests' object has no attribute 'runTest'

It looks like either the _testMethodName is not being set properly on the copied/metaprogrammed test class objects, or the runTest method is missing from them. Not sure which, being unfamiliar with the way that's set up.

Versions

master as of today (the metaprogramming bug is pre-existing, but one of these inductor tests got flagged recently as 'slow' and automatically stuck in the aforementioned .json by CI)

cc @ezyang @soumith @msaroufim @ngimel @bdhirsh @voznesenskym @penguinwu @anijain2305 @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @peterbell10 @desertfire

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions