Skip to content

Commit 6670adf

Browse files
committed
using pop for array element deletion
passing exception during folder removal removal of additional variable
1 parent 7bc337b commit 6670adf

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

pandas/io/parquet.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,7 @@ def write(self, df, path, compression='snappy', index=None,
225225
# Use tobytes() instead.
226226

227227
if 'partition_on' in kwargs:
228-
partition_cols = kwargs['partition_on']
229-
del kwargs['partition_on']
228+
partition_cols = kwargs.pop('partition_on')
230229

231230
if partition_cols is not None:
232231
kwargs['file_scheme'] = 'hive'

pandas/tests/util/test_testing.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -878,9 +878,7 @@ def test_datapath_missing(datapath, request):
878878

879879

880880
def test_create_temp_directory():
881-
temppath = ''
882881
with tm.ensure_clean_dir() as path:
883882
assert os.path.exists(path)
884883
assert os.path.isdir(path)
885-
temppath = path
886-
assert not os.path.exists(temppath)
884+
assert not os.path.exists(path)

pandas/util/testing.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151

5252
from pandas._libs import testing as _testing
5353
from pandas.io.common import urlopen
54+
from shutil import rmtree
5455

5556

5657
N = 30
@@ -786,10 +787,9 @@ def ensure_clean_dir():
786787
yield directory_name
787788
finally:
788789
try:
789-
import shutil
790-
shutil.rmtree(directory_name)
790+
rmtree(directory_name)
791791
except Exception as e:
792-
print("Exception on removing folder: {error}".format(error=e))
792+
pass
793793

794794

795795
# -----------------------------------------------------------------------------

0 commit comments

Comments
 (0)