Skip to content

Commit

Permalink
py2 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
kszucs committed Sep 24, 2019
1 parent d372287 commit 8585a60
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 2 additions & 0 deletions python/pyarrow/fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@
from pyarrow._s3 import S3FileSystem, initialize_s3, finalize_s3 # noqa
except ImportError:
pass
else:
pass # initialize_s3?
18 changes: 17 additions & 1 deletion python/pyarrow/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,22 @@ def datadir():
return pathlib.Path(__file__).parent / 'data'


try:
from tempfile import TemporaryDirectory
except ImportError:
import shutil

class TemporaryDirectory(object):
"""Temporary directory implementation for python 2"""

def __enter__(self):
self.tmp = tempfile.mkdtemp()
return self.tmp

def __exit__(self, exc_type, exc_value, traceback):
shutil.rmtree(self.tmp)


@pytest.fixture(scope='module')
@pytest.mark.s3
def minio_server():
Expand All @@ -244,7 +260,7 @@ def minio_server():
})

try:
with tempfile.TemporaryDirectory() as tempdir:
with TemporaryDirectory() as tempdir:
args = ['minio', '--compat', 'server', '--quiet', '--address',
address, tempdir]
with subprocess.Popen(args, env=env) as proc:
Expand Down

0 comments on commit 8585a60

Please sign in to comment.