From a97b6d17428cd4f2bfc0f647fb1b8200095c5d6a Mon Sep 17 00:00:00 2001 From: Brock Mendel Date: Fri, 10 Jan 2020 16:38:21 -0800 Subject: [PATCH 1/2] BUG: pickle files ensure_clean --- pandas/_testing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/_testing.py b/pandas/_testing.py index 0b81fb0f7a8d5..35cd779baa69a 100644 --- a/pandas/_testing.py +++ b/pandas/_testing.py @@ -123,8 +123,8 @@ def round_trip_pickle( if _path is None: _path = f"__{rands(10)}__.pickle" with ensure_clean(_path) as path: - pd.to_pickle(obj, _path) - return pd.read_pickle(_path) + pd.to_pickle(obj, path) + return pd.read_pickle(path) def round_trip_pathlib(writer, reader, path: Optional[str] = None): From badd4f1864d42a1db2f9607fa62dec5ad677f064 Mon Sep 17 00:00:00 2001 From: Brock Mendel Date: Fri, 10 Jan 2020 17:11:07 -0800 Subject: [PATCH 2/2] mypy fixup --- pandas/_testing.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/_testing.py b/pandas/_testing.py index 35cd779baa69a..1fdc5d478aaf6 100644 --- a/pandas/_testing.py +++ b/pandas/_testing.py @@ -122,9 +122,9 @@ def round_trip_pickle( _path = path if _path is None: _path = f"__{rands(10)}__.pickle" - with ensure_clean(_path) as path: - pd.to_pickle(obj, path) - return pd.read_pickle(path) + with ensure_clean(_path) as temp_path: + pd.to_pickle(obj, temp_path) + return pd.read_pickle(temp_path) def round_trip_pathlib(writer, reader, path: Optional[str] = None):