(self)
| 531 | pass |
| 532 | |
| 533 | def test_failing_import_sticks(self): |
| 534 | source = TESTFN + ".py" |
| 535 | with open(source, "w", encoding='utf-8') as f: |
| 536 | print("a = 1/0", file=f) |
| 537 | |
| 538 | # New in 2.4, we shouldn't be able to import that no matter how often |
| 539 | # we try. |
| 540 | sys.path.insert(0, os.curdir) |
| 541 | importlib.invalidate_caches() |
| 542 | if TESTFN in sys.modules: |
| 543 | del sys.modules[TESTFN] |
| 544 | try: |
| 545 | for i in [1, 2, 3]: |
| 546 | self.assertRaises(ZeroDivisionError, __import__, TESTFN) |
| 547 | self.assertNotIn(TESTFN, sys.modules, |
| 548 | "damaged module in sys.modules on %i try" % i) |
| 549 | finally: |
| 550 | del sys.path[0] |
| 551 | remove_files(TESTFN) |
| 552 | |
| 553 | def test_import_name_binding(self): |
| 554 | # import x.y.z binds x in the current namespace |
nothing calls this directly
no test coverage detected