(
self, monkeypatch: MonkeyPatch, tmp_path: Path
)
| 789 | ) |
| 790 | |
| 791 | def test_insert_missing_modules( |
| 792 | self, monkeypatch: MonkeyPatch, tmp_path: Path |
| 793 | ) -> None: |
| 794 | monkeypatch.chdir(tmp_path) |
| 795 | # Use 'xxx' and 'xxy' as parent names as they are unlikely to exist and |
| 796 | # don't end up being imported. |
| 797 | modules = {"xxx.tests.foo": ModuleType("xxx.tests.foo")} |
| 798 | insert_missing_modules(modules, "xxx.tests.foo") |
| 799 | assert sorted(modules) == ["xxx", "xxx.tests", "xxx.tests.foo"] |
| 800 | |
| 801 | mod = ModuleType("mod", doc="My Module") |
| 802 | modules = {"xxy": mod} |
| 803 | insert_missing_modules(modules, "xxy") |
| 804 | assert modules == {"xxy": mod} |
| 805 | |
| 806 | modules = {} |
| 807 | insert_missing_modules(modules, "") |
| 808 | assert modules == {} |
| 809 | |
| 810 | @pytest.mark.parametrize("b_is_package", [True, False]) |
| 811 | @pytest.mark.parametrize("insert_modules", [True, False]) |
nothing calls this directly
no test coverage detected