|
32 | 32 |
|
33 | 33 | import astroid |
34 | 34 |
|
| 35 | +import pynguin.configuration as config |
35 | 36 | import pynguin.utils.statistics.statistics as stat |
36 | 37 | import pynguin.utils.typetracing as tt |
37 | 38 |
|
|
85 | 86 |
|
86 | 87 | LOGGER = logging.getLogger(__name__) |
87 | 88 |
|
88 | | -# A set of modules that shall be blacklisted from analysis (keep them sorted!!!): |
| 89 | +# A set of modules that shall be blacklisted from analysis (keep them sorted to ease |
| 90 | +# future manipulations or looking up module names of this set!!!): |
89 | 91 | # The modules that are listed here are not prohibited from execution, but Pynguin will |
90 | 92 | # not consider any classes or functions from these modules for generating inputs to |
91 | 93 | # other routines |
@@ -188,27 +190,30 @@ def _is_blacklisted(element: Any) -> bool: |
188 | 190 | Returns: |
189 | 191 | Is the element blacklisted? |
190 | 192 | """ |
| 193 | + module_blacklist = set(MODULE_BLACKLIST).union(config.configuration.ignore_modules) |
| 194 | + method_blacklist = set(METHOD_BLACKLIST).union(config.configuration.ignore_methods) |
| 195 | + |
191 | 196 | if inspect.ismodule(element): |
192 | | - return element.__name__ in MODULE_BLACKLIST |
| 197 | + return element.__name__ in module_blacklist |
193 | 198 | if inspect.isclass(element): |
194 | 199 | if element.__module__ == "builtins" and ( |
195 | 200 | element in PRIMITIVES or element in COLLECTIONS |
196 | 201 | ): |
197 | 202 | # Allow some builtin types |
198 | 203 | return False |
199 | | - return element.__module__ in MODULE_BLACKLIST |
| 204 | + return element.__module__ in module_blacklist |
200 | 205 | if inspect.isfunction(element): |
201 | 206 | # Some modules can be run standalone using a main function or provide a small |
202 | 207 | # set of tests ('test'). We don't want to include those functions. |
203 | 208 | return ( |
204 | | - element.__module__ in MODULE_BLACKLIST |
| 209 | + element.__module__ in module_blacklist |
205 | 210 | or element.__qualname__.startswith( |
206 | 211 | ( |
207 | 212 | "main", |
208 | 213 | "test", |
209 | 214 | ) |
210 | 215 | ) |
211 | | - or f"{element.__module__}.{element.__qualname__}" in METHOD_BLACKLIST |
| 216 | + or f"{element.__module__}.{element.__qualname__}" in method_blacklist |
212 | 217 | ) |
213 | 218 | # Something that is not supported yet. |
214 | 219 | return False |
|
0 commit comments