(module_name)
| 243 | |
| 244 | |
| 245 | def import_module(module_name): |
| 246 | import io |
| 247 | from contextlib import redirect_stdout |
| 248 | |
| 249 | # Importing modules causes ('Constant String', 2, None, 4) and |
| 250 | # "Hello world!" to be printed to stdout. |
| 251 | f = io.StringIO() |
| 252 | with warnings.catch_warnings(), redirect_stdout(f): |
| 253 | # ignore warnings caused by importing deprecated modules |
| 254 | warnings.filterwarnings("ignore", category=DeprecationWarning) |
| 255 | try: |
| 256 | module = __import__(module_name) |
| 257 | except Exception as e: |
| 258 | return e |
| 259 | return module |
| 260 | |
| 261 | |
| 262 | def is_child(module, item): |
no test coverage detected