xref: /aosp_15_r20/external/executorch/extension/pybindings/test/test_pybindings.py (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1# Copyright (c) Meta Platforms, Inc. and affiliates.
2# All rights reserved.
3#
4# This source code is licensed under the BSD-style license found in the
5# LICENSE file in the root directory of this source tree.
6
7# pyre-unsafe
8
9import unittest
10
11kernel_mode = None  # either aten mode or portable mode
12try:
13    from executorch.extension.pybindings import portable_lib as runtime
14
15    kernel_mode = "portable"
16except Exception:
17    print("can't load portable lib")
18
19if kernel_mode is None:
20    try:
21        from executorch.extension.pybindings import aten_lib as runtime  # noqa: F811
22
23        kernel_mode = "aten"
24    except Exception:
25        print("can't load aten lib")
26
27assert kernel_mode is not None
28
29
30from executorch.extension.pybindings.test.make_test import make_test
31
32
33class PybindingsTest(unittest.TestCase):
34    def test(self):
35        make_test(self, runtime)(self)
36