(self, pytester: Pytester)
| 116 | reprec.assertoutcome(failed=1) |
| 117 | |
| 118 | def test_importmode(self, pytester: Pytester): |
| 119 | pytester.makepyfile( |
| 120 | **{ |
| 121 | "src/namespacepkg/innerpkg/__init__.py": "", |
| 122 | "src/namespacepkg/innerpkg/a.py": """ |
| 123 | def some_func(): |
| 124 | return 42 |
| 125 | """, |
| 126 | "src/namespacepkg/innerpkg/b.py": """ |
| 127 | from namespacepkg.innerpkg.a import some_func |
| 128 | def my_func(): |
| 129 | ''' |
| 130 | >>> my_func() |
| 131 | 42 |
| 132 | ''' |
| 133 | return some_func() |
| 134 | """, |
| 135 | } |
| 136 | ) |
| 137 | # For 'namespacepkg' to be considered a namespace package, its containing directory |
| 138 | # needs to be reachable from sys.path: |
| 139 | # https://packaging.python.org/en/latest/guides/packaging-namespace-packages |
| 140 | pytester.syspathinsert(pytester.path / "src") |
| 141 | reprec = pytester.inline_run("--doctest-modules", "--import-mode=importlib") |
| 142 | reprec.assertoutcome(passed=1) |
| 143 | |
| 144 | def test_new_pattern(self, pytester: Pytester): |
| 145 | p = pytester.maketxtfile( |
nothing calls this directly
no test coverage detected