(self, pytester: Pytester, monkeypatch)
| 166 | result.stdout.fnmatch_lines(["*assert 1 == 2*"]) |
| 167 | |
| 168 | def test_honors_pep_235(self, pytester: Pytester, monkeypatch) -> None: |
| 169 | # note: couldn't make it fail on macos with a single `sys.path` entry |
| 170 | # note: these modules are named `test_*` to trigger rewriting |
| 171 | pytester.makepyfile(test_y="x = 1") |
| 172 | xdir = pytester.mkdir("x") |
| 173 | pytester.mkpydir(str(xdir.joinpath("test_Y"))) |
| 174 | xdir.joinpath("test_Y").joinpath("__init__.py").write_text("x = 2") |
| 175 | pytester.makepyfile( |
| 176 | "import test_y\n" |
| 177 | "import test_Y\n" |
| 178 | "def test():\n" |
| 179 | " assert test_y.x == 1\n" |
| 180 | " assert test_Y.x == 2\n" |
| 181 | ) |
| 182 | monkeypatch.syspath_prepend(str(xdir)) |
| 183 | pytester.runpytest().assert_outcomes(passed=1) |
| 184 | |
| 185 | def test_name(self, request) -> None: |
| 186 | def f1() -> None: |
nothing calls this directly
no test coverage detected