Coverage for gwcelery/tasks/__init__.py: 100%

12 statements  

« prev     ^ index     » next       coverage.py v7.4.4, created at 2024-11-14 05:52 +0000

1"""All Celery tasks are declared in submodules of this module.""" 

2 

3 

4def _import_all_submodules(module=vars()): 

5 import importlib 

6 import pkgutil 

7 

8 try: 

9 path = module['__path__'] 

10 except KeyError: 

11 # not a package, does not have submodules 

12 return 

13 for _, name, _ in pkgutil.iter_modules(path): 

14 submodule = importlib.import_module('.' + name, module['__name__']) 

15 module[name] = submodule 

16 _import_all_submodules(vars(submodule)) 

17 

18 

19_import_all_submodules()