mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Pull Request resolved: https://github.com/pytorch/pytorch/pull/150787 Approved by: https://github.com/zou3519
32 lines
768 B
Python
32 lines
768 B
Python
# Owner(s): ["module: dynamo"]
|
|
import unittest
|
|
|
|
import torch
|
|
import torch._dynamo.test_case
|
|
from torch.testing._internal.common_utils import make_dynamo_test
|
|
|
|
|
|
class TestUnittest(torch._dynamo.test_case.TestCase):
|
|
def setUp(self):
|
|
self._prev = torch._dynamo.config.enable_trace_unittest
|
|
torch._dynamo.config.enable_trace_unittest = True
|
|
|
|
def tearDown(self):
|
|
torch._dynamo.config.enable_trace_unittest = self._prev
|
|
|
|
@make_dynamo_test
|
|
def test_SkipTest(self):
|
|
z = 0
|
|
SkipTest = unittest.SkipTest
|
|
try:
|
|
raise SkipTest("abcd")
|
|
except Exception:
|
|
z = 1
|
|
self.assertEqual(z, 1)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
from torch._dynamo.test_case import run_tests
|
|
|
|
run_tests()
|