(self)
| 543 | self._check_relative_imports(depth, "__main__") |
| 544 | |
| 545 | def test_run_name(self): |
| 546 | depth = 1 |
| 547 | run_name = "And now for something completely different" |
| 548 | pkg_dir, mod_fname, mod_name, mod_spec = ( |
| 549 | self._make_pkg(example_source, depth)) |
| 550 | forget(mod_name) |
| 551 | expected_ns = example_namespace.copy() |
| 552 | expected_ns.update({ |
| 553 | "__name__": run_name, |
| 554 | "__file__": mod_fname, |
| 555 | "__package__": mod_name.rpartition(".")[0], |
| 556 | "__spec__": mod_spec, |
| 557 | }) |
| 558 | def create_ns(init_globals): |
| 559 | return run_module(mod_name, init_globals, run_name) |
| 560 | try: |
| 561 | self.check_code_execution(create_ns, expected_ns) |
| 562 | finally: |
| 563 | self._del_pkg(pkg_dir) |
| 564 | |
| 565 | def test_pkgutil_walk_packages(self): |
| 566 | # This is a dodgy hack to use the test_runpy infrastructure to test |
nothing calls this directly
no test coverage detected