looplang/looplang/test/__init__.py

23 lines
1019 B
Python

import os
from unittest import main
from . import utils
# Info for big tests
if not utils.RUN_BIG_TESTS:
print("Skip big tests. To run them set environmetn variable RUN_BIG_TESTS.")
# Load sub packages
def _load_subpackages(path, package):
for module in filter(lambda x: not x.startswith("_"), os.listdir(path)):
module_path = os.path.join(path, module)
if os.path.isfile(module_path) and module.endswith(".py") and "." not in module[:-3]:
for iID, i in filter(lambda x: not x[0].startswith("_"), __import__("%s.%s" % (package, module[:-3]), fromlist=(package,)).__dict__.items()):
globals()[iID] = i
elif os.path.isdir(module_path) and "." not in module:
package_name = "%s.%s" % (package, module)
for iID, i in __import__(package_name, fromlist=(package,)).__dict__.items():
globals()[iID] = i
_load_subpackages(module_path, package_name)
_load_subpackages(os.path.split(__file__)[0], "looplang.test")