add support for Python 3.10 (#6422)

* add support for Python 3.10

pyarrow is not available, so we are skipping tests for it.
And, restricting `hdfs` extras to be not installed in Python3.10.

Pathlib removed `_init` method and `init` parameter, so just working
around that. It's not a big change.

* skip windows on 3.10; update pip/wheel/setuptools during install

pywin32 is not yet available for 3.10 Python, so skipping those for now

* install libgit2 with Python3.10 as pygit2 wheel is not available

* install libgit2

* only run on macOS, libgit2-1.1 not available on ubuntu
This commit is contained in:
Saugat Pachhai
2021-08-16 16:24:28 +05:45
committed by GitHub
parent a285d2ba47
commit 1bb7f39e14
4 changed files with 30 additions and 12 deletions
+8 -2
View File
@@ -47,6 +47,7 @@ from global repo template to creating everything inplace, which:
import os
import pathlib
import sys
from contextlib import contextmanager
from textwrap import dedent
@@ -81,12 +82,17 @@ class TmpDir(pathlib.Path):
cls = ( # pylint: disable=self-cls-assignment
WindowsTmpDir if os.name == "nt" else PosixTmpDir
)
self = cls._from_parts(args, init=False)
# init parameter and `_init` method has been removed in Python 3.10.
kw = {"init": False} if sys.version_info < (3, 10) else {}
self = cls._from_parts( # pylint: disable=unexpected-keyword-arg
args, **kw
)
if not self._flavour.is_supported:
raise NotImplementedError(
f"cannot instantiate {cls.__name__!r} on your system"
)
self._init()
if sys.version_info < (3, 10):
self._init() # pylint: disable=no-member
return self
def init(self, *, scm=False, dvc=False, subdir=False):
+10 -1
View File
@@ -2,6 +2,7 @@ import locale
import os
import platform
import subprocess
import sys
import uuid
from contextlib import contextmanager
from pathlib import Path
@@ -74,6 +75,9 @@ class HDFS(Base, URLInfo): # pylint: disable=abstract-method
def hadoop(test_config):
test_config.requires("hdfs")
if sys.version_info >= (3, 10):
pytest.skip("pyarrow is not available for 3.10 yet.")
if platform.system() != "Linux":
pytest.skip("only supported on Linux")
@@ -240,11 +244,16 @@ class FakeHadoopFileSystem:
@pytest.fixture
def hdfs(mocker):
def hdfs(test_config, mocker):
# Windows might not have Visual C++ Redistributable for Visual Studio
# 2015 installed, which will result in the following error:
# "The pyarrow installation is not built with support for
# 'HadoopFileSystem'"
test_config.requires("hdfs")
if sys.version_info >= (3, 10):
pytest.skip("pyarrow is not available for 3.10 yet.")
mocker.patch("pyarrow.fs._not_imported", [])
mocker.patch(
"pyarrow.fs.HadoopFileSystem", FakeHadoopFileSystem, create=True