diff --git a/tests/python/test_dgl_import.py b/tests/python/test_dgl_import.py new file mode 100644 index 000000000000..3c4b5ab84e0c --- /dev/null +++ b/tests/python/test_dgl_import.py @@ -0,0 +1,10 @@ +import sys + + +def test_graphbolt_is_not_imported(): + assert ( + "dgl.graphbolt" not in sys.modules + ), "dgl.graphbolt is already imported" + import dgl + + assert "dgl.graphbolt" not in sys.modules, "dgl.graphbolt is imported" diff --git a/tests/scripts/task_unit_test.sh b/tests/scripts/task_unit_test.sh index 2dae1594a4ba..5d74ffd84cc1 100644 --- a/tests/scripts/task_unit_test.sh +++ b/tests/scripts/task_unit_test.sh @@ -39,6 +39,7 @@ if [ $DGLBACKEND == "mxnet" ] then python3 -m pytest -v --junitxml=pytest_compute.xml --durations=100 --ignore=tests/python/common/test_ffi.py tests/python/common || fail "common" else + python3 -m pytest -v --junitxml=pytest_dgl_import.xml tests/python/test_dgl_import.py || fail "dgl_import" python3 -m pytest -v --junitxml=pytest_common.xml --durations=100 tests/python/common || fail "common" fi python3 -m pytest -v --junitxml=pytest_backend.xml --durations=100 tests/python/$DGLBACKEND || fail "backend-specific"