(self)
| 612 | assert "os" not in module_reloader.modules.keys() |
| 613 | |
| 614 | def test_autoreload_output(self): |
| 615 | self.shell.magic_autoreload("complete") |
| 616 | mod_code = """ |
| 617 | def func1(): pass |
| 618 | """ |
| 619 | mod_name, mod_fn = self.new_module(mod_code) |
| 620 | self.shell.run_code(f"import {mod_name}") |
| 621 | with tt.AssertPrints("", channel="stdout"): # no output; this is default |
| 622 | self.shell.run_code("pass") |
| 623 | |
| 624 | self.shell.magic_autoreload("complete --print") |
| 625 | self.write_file(mod_fn, mod_code) # "modify" the module |
| 626 | with tt.AssertPrints( |
| 627 | f"Reloading '{mod_name}'.", channel="stdout" |
| 628 | ): # see something printed out |
| 629 | self.shell.run_code("pass") |
| 630 | |
| 631 | self.shell.magic_autoreload("complete -p") |
| 632 | self.write_file(mod_fn, mod_code) # "modify" the module |
| 633 | with tt.AssertPrints( |
| 634 | f"Reloading '{mod_name}'.", channel="stdout" |
| 635 | ): # see something printed out |
| 636 | self.shell.run_code("pass") |
| 637 | |
| 638 | self.shell.magic_autoreload("complete --print --log") |
| 639 | self.write_file(mod_fn, mod_code) # "modify" the module |
| 640 | with tt.AssertPrints( |
| 641 | f"Reloading '{mod_name}'.", channel="stdout" |
| 642 | ): # see something printed out |
| 643 | self.shell.run_code("pass") |
| 644 | |
| 645 | self.shell.magic_autoreload("complete --print --log") |
| 646 | self.write_file(mod_fn, mod_code) # "modify" the module |
| 647 | with self.assertLogs(logger="autoreload") as lo: # see something printed out |
| 648 | self.shell.run_code("pass") |
| 649 | assert lo.output == [f"INFO:autoreload:Reloading '{mod_name}'."] |
| 650 | |
| 651 | self.shell.magic_autoreload("complete -l") |
| 652 | self.write_file(mod_fn, mod_code) # "modify" the module |
| 653 | with self.assertLogs(logger="autoreload") as lo: # see something printed out |
| 654 | self.shell.run_code("pass") |
| 655 | assert lo.output == [f"INFO:autoreload:Reloading '{mod_name}'."] |
| 656 | |
| 657 | def _check_smoketest(self, use_aimport=True): |
| 658 | """ |
nothing calls this directly
no test coverage detected