drgn/tests/test_python.py
Kevin Svetlitski d3c9e24115 tests: make all tests inherit from drgn's TestCase class
The majority of test cases already inherited from drgn's TestCase class.
The few outliers that inherited directly from unittest.TestCase have
been brought in line with the other tests.

Signed-off-by: Kevin Svetlitski <svetlitski@fb.com>
2022-01-11 17:28:17 -08:00

26 lines
948 B
Python

# Copyright (c) Meta Platforms, Inc. and affiliates.
# SPDX-License-Identifier: GPL-3.0-or-later
import _drgn
import drgn
from tests import TestCase
class TestModule(TestCase):
def test_all(self):
# At least for now, everything in the Python library should go in
# __all__, so make sure that happens.
from_python = {
name
for name in dir(drgn)
if not name.startswith("_")
and getattr(getattr(drgn, name), "__module__", "").startswith("drgn")
}
self.assertEqual(from_python - set(drgn.__all__), set())
def test_bindings(self):
# Make sure everything in the C extension (_drgn) is added to the
# Python library (drgn).
from_extension = {name for name in dir(_drgn) if not name.startswith("_")}
self.assertEqual(from_extension - set(dir(drgn)), set())
self.assertEqual(from_extension - set(drgn.__all__), set())