[BE] simplify test_cpp_extensions_aot and .gitignore (#149231)

It is shady to clean up an install mid-test. So don't do that anymore and use .gitignore instead.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/149231
Approved by: https://github.com/albanD, https://github.com/msaroufim
This commit is contained in:
Jane Xu
2025-03-17 13:06:02 -07:00
committed by PyTorch MergeBot
parent b99fc9d29f
commit 88a26dbb9d
2 changed files with 1 additions and 15 deletions

4
.gitignore vendored
View File

@ -62,9 +62,7 @@ test/forward_backward_compatibility/nightly_schemas.txt
dropout_model.pt dropout_model.pt
test/generated_type_hints_smoketest.py test/generated_type_hints_smoketest.py
test/htmlcov test/htmlcov
test/cpp_extensions/install/ test/cpp_extensions/**/install
test/cpp_extensions/open_registration_extension/install
test/cpp_extensions/libtorch_agnostic_extension/install
test/kernel.errors.txt test/kernel.errors.txt
third_party/build/ third_party/build/
third_party/nccl/ third_party/nccl/

View File

@ -3,7 +3,6 @@
import os import os
import re import re
import subprocess import subprocess
import sys
import unittest import unittest
from itertools import repeat from itertools import repeat
from pathlib import Path from pathlib import Path
@ -16,7 +15,6 @@ import torch.utils.cpp_extension
from torch.testing._internal.common_cuda import TEST_CUDA from torch.testing._internal.common_cuda import TEST_CUDA
from torch.testing._internal.common_utils import ( from torch.testing._internal.common_utils import (
IS_WINDOWS, IS_WINDOWS,
shell,
skipIfTorchDynamo, skipIfTorchDynamo,
TEST_XPU, TEST_XPU,
xfailIfTorchDynamo, xfailIfTorchDynamo,
@ -217,16 +215,6 @@ class TestCppExtensionAOT(common.TestCase):
missing_symbols = subprocess.check_output(["nm", "-u", so_file]).decode("utf-8") missing_symbols = subprocess.check_output(["nm", "-u", so_file]).decode("utf-8")
self.assertFalse("Py" in missing_symbols) self.assertFalse("Py" in missing_symbols)
# finally, clean up the folder
cmd = [sys.executable, "setup.py", "clean"]
return_code = shell(
cmd,
cwd=os.path.join("cpp_extensions", "python_agnostic_extension"),
env=os.environ.copy(),
)
if return_code != 0:
return return_code
@unittest.skipIf(not TEST_CUDA, "some aspects of this test require CUDA") @unittest.skipIf(not TEST_CUDA, "some aspects of this test require CUDA")
def test_libtorch_agnostic(self): def test_libtorch_agnostic(self):
import libtorch_agnostic import libtorch_agnostic