tmp_path
https://docs.pytest.org/en/7.1.x/reference/reference.html#tmp-path
関数スコープのフィクスチャ
チュートリアル:How to use temporary directories and files in tests
Return a temporary directory path object which is unique to each test function invocation, created as a sub directory of the base temporary directory.
The returned object is a pathlib.Path object.
macOSではmktemp -dで一時ファイルのディレクトリを確認
pytest-of-<ユーザ名>ディレクトリを覗く
TODO:もっと簡単に確認したい(failのメッセージには出ているっぽい)
積ん読:https://docs.pytest.org/en/stable/how-to/tmp_path.html#temporary-directory-location-and-retention
実装はPython tempfileを使っている(ラップしている!)
https://github.com/pytest-dev/pytest/blob/7.4.0/src/_pytest/tmpdir.py#L260
_mk_tmp https://github.com/pytest-dev/pytest/blob/7.4.0/src/_pytest/tmpdir.py#L251
TempPathFactory https://github.com/pytest-dev/pytest/blob/7.4.0/src/_pytest/tmpdir.py#L46
mktemp https://github.com/pytest-dev/pytest/blob/7.4.0/src/_pytest/tmpdir.py#L120
getbasetemp https://github.com/pytest-dev/pytest/blob/7.4.0/src/_pytest/tmpdir.py#L144
Path(from_env or tempfile.gettempdir())
Pathを元にmkdirする(tempfileで作るわけでなく、一時ファイルを作れるパスを得て、このクラスで作る)