Replace pytest tmpdir with tmp_path fixture

The pytest tmpdir fixture uses a legacy path object, but we're using the pathlib.Path implementation throughout the codebase. Therefore we need to replace tmpdir with tmp_path.