MCPcopy Index your code
hub / github.com/pgadmin-org/pgadmin4 / load_generators

Method load_generators

web/pgadmin/utils/route.py:63–113  ·  view source on GitHub ↗
(cls, pkg_args, pkg_root, exclude_pkgs, for_modules=[],
                        is_resql_only=False)

Source from the content-addressed store, hash-verified

61
62 @classmethod
63 def load_generators(cls, pkg_args, pkg_root, exclude_pkgs, for_modules=[],
64 is_resql_only=False):
65
66 cls.registry = dict()
67
68 all_modules = []
69
70 try:
71 for module_name in find_modules(pkg_root, False, True):
72 all_modules.append(module_name)
73 except Exception:
74 pass
75
76 if 'resql' not in exclude_pkgs:
77 # Append reverse engineered test case module
78 all_modules.append('regression.re_sql.tests.test_resql')
79
80 if (pkg_args is None or pkg_args == "all") and \
81 'feature_tests' not in exclude_pkgs:
82 # Append feature tests module
83 all_modules += find_modules(
84 'regression.feature_tests', False, True)
85
86 # If specific modules are to be tested, exclude others
87 # for modules are handled differently for resql
88 if not is_resql_only and len(for_modules) > 0:
89 all_modules = [module_name
90 for module_name in all_modules
91 for fmod in for_modules
92 if module_name.endswith(fmod)]
93
94 # Set the module list and exclude packages in the BaseTestGenerator
95 # for Reverse Engineer SQL test cases.
96 BaseTestGenerator.setReSQLModuleList(all_modules)
97 BaseTestGenerator.setExcludePkgs(exclude_pkgs)
98
99 # Check if only reverse engineered sql test cases to run
100 # if yes then import only that module
101 if is_resql_only:
102 BaseTestGenerator.setForModules(for_modules)
103 # In case of RESQL only clear the registry of modules, as
104 # RESQL test cases should be run.
105 cls.registry = dict()
106 try:
107 import_module('regression.re_sql.tests.test_resql')
108 except ImportError:
109 traceback.print_exc(file=sys.stderr)
110 else:
111 # Check for SERVER mode
112 TestsGeneratorRegistry._exclude_packages(all_modules,
113 exclude_pkgs)
114
115 @staticmethod
116 def _exclude_packages(all_modules, exclude_pkgs):

Callers 1

load_modulesFunction · 0.80

Calls 5

appendMethod · 0.80
setReSQLModuleListMethod · 0.80
setExcludePkgsMethod · 0.80
setForModulesMethod · 0.80
_exclude_packagesMethod · 0.80

Tested by 1

load_modulesFunction · 0.64