Skip to content

Commit 6394982

Browse files
authored
gate load_library tests behind BUILD_TEST=1 (pytorch#46556)
ghstack-source-id: 9147465 Pull Request resolved: pytorch#46550
1 parent 56166c1 commit 6394982

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

test/jit/test_backends.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ def setUp(self):
5656
super().setUp()
5757
if TEST_WITH_ROCM or IS_SANDCASTLE or IS_WINDOWS or IS_MACOS:
5858
raise unittest.SkipTest("non-portable load_library call used in test")
59+
if not torch._C._jit_has_cpp_tests():
60+
raise unittest.SkipTest("Tests were not built, use BUILD_TEST=1")
5961
torch_root = Path(__file__).resolve().parent.parent.parent
6062
p = torch_root / 'build' / 'lib' / 'libjitbackend_test.so'
6163
torch.ops.load_library(str(p))

test/jit/test_torchbind.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ class TestTorchbind(JitTestCase):
2626
def setUp(self):
2727
if TEST_WITH_ROCM or IS_SANDCASTLE or IS_WINDOWS or IS_MACOS:
2828
raise unittest.SkipTest("non-portable load_library call used in test")
29+
if not torch._C._jit_has_cpp_tests():
30+
raise unittest.SkipTest("Tests were not built, use BUILD_TEST=1")
2931
torch_root = Path(__file__).resolve().parent.parent.parent
3032
p = torch_root / 'build' / 'lib' / 'libtorchbind_test.so'
3133
torch.ops.load_library(str(p))

0 commit comments

Comments
 (0)