mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-28 15:53:55 -04:00
tests: Fix test_imports_panda3d for frozen/embedded panda3d package
This commit is contained in:
parent
4f9542c96a
commit
868a4eac47
@ -9,23 +9,30 @@ import pytest
|
|||||||
|
|
||||||
|
|
||||||
def test_imports_panda3d():
|
def test_imports_panda3d():
|
||||||
import importlib, os
|
import importlib, os, sys
|
||||||
import panda3d
|
import panda3d
|
||||||
dir = os.path.dirname(panda3d.__file__)
|
|
||||||
|
|
||||||
# Iterate over the things in the panda3d package that look like modules.
|
# Look for panda3d.* modules in builtins - pfreeze might put them there.
|
||||||
extensions = set(importlib.machinery.all_suffixes())
|
for mod in sys.builtin_module_names:
|
||||||
|
if mod.startswith('panda3d.'):
|
||||||
|
importlib.import_module(mod)
|
||||||
|
|
||||||
for basename in os.listdir(dir):
|
if panda3d.__spec__.origin != 'frozen':
|
||||||
if basename.startswith('lib'):
|
dir = os.path.dirname(panda3d.__file__)
|
||||||
# This not a Python module.
|
|
||||||
continue
|
|
||||||
|
|
||||||
module = basename.split('.', 1)[0]
|
# Iterate over the things in the panda3d package that look like modules.
|
||||||
ext = basename[len(module):]
|
extensions = set(importlib.machinery.all_suffixes())
|
||||||
|
|
||||||
if ext in extensions:
|
for basename in os.listdir(dir):
|
||||||
importlib.import_module('panda3d.%s' % (module))
|
if basename.startswith('lib'):
|
||||||
|
# This not a Python module.
|
||||||
|
continue
|
||||||
|
|
||||||
|
module = basename.split('.', 1)[0]
|
||||||
|
ext = basename[len(module):]
|
||||||
|
|
||||||
|
if ext in extensions:
|
||||||
|
importlib.import_module('panda3d.%s' % (module))
|
||||||
|
|
||||||
|
|
||||||
def test_imports_direct():
|
def test_imports_direct():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user