(self, pytester: Pytester, monkeypatch)
| 1465 | sys.platform.startswith("sunos5"), reason="cannot remove cwd on Solaris" |
| 1466 | ) |
| 1467 | def test_cwd_changed(self, pytester: Pytester, monkeypatch) -> None: |
| 1468 | # Setup conditions for py's fspath trying to import pathlib on py34 |
| 1469 | # always (previously triggered via xdist only). |
| 1470 | # Ref: https://github.com/pytest-dev/py/pull/207 |
| 1471 | monkeypatch.syspath_prepend("") |
| 1472 | monkeypatch.delitem(sys.modules, "pathlib", raising=False) |
| 1473 | |
| 1474 | pytester.makepyfile( |
| 1475 | **{ |
| 1476 | "test_setup_nonexisting_cwd.py": """\ |
| 1477 | import os |
| 1478 | import tempfile |
| 1479 | |
| 1480 | with tempfile.TemporaryDirectory() as d: |
| 1481 | os.chdir(d) |
| 1482 | """, |
| 1483 | "test_test.py": """\ |
| 1484 | def test(): |
| 1485 | pass |
| 1486 | """, |
| 1487 | } |
| 1488 | ) |
| 1489 | result = pytester.runpytest() |
| 1490 | result.stdout.fnmatch_lines(["* 1 passed in *"]) |
| 1491 | |
| 1492 | |
| 1493 | class TestAssertionPass: |
nothing calls this directly
no test coverage detected