diff --git a/noxfile.py b/noxfile.py index cc6c05ef..ecef4b1a 100644 --- a/noxfile.py +++ b/noxfile.py @@ -118,7 +118,7 @@ def pypy_setup(local_deps, session): # Install NumPy and SciPy from pre-built wheels. Don't use ``DEPS`` # to specify version range for NumPy and SciPy. session.install( - "--no-index", "--find-links", wheelhouse, "numpy", "scipy" + "--no-index", "--find-links", str(wheelhouse), "numpy", "scipy" ) return local_deps @@ -184,7 +184,11 @@ def unit(session): # Install this package. install_bezier(session, debug=True) # Run pytest against the unit tests. - run_args = ["pytest"] + session.posargs + [get_path("tests", "unit")] + run_args = ( + ["python", "-m", "pytest"] + + session.posargs + + [get_path("tests", "unit")] + ) session.run(*run_args) @@ -201,7 +205,7 @@ def cover(session): # Install this package. install_bezier(session, debug=True) # Run pytest with coverage against the unit tests. - run_args = ["pytest", "--cov=bezier", "--cov=tests.unit"] + run_args = ["python", "-m", "pytest", "--cov=bezier", "--cov=tests.unit"] run_args += session.posargs run_args += [get_path("tests", "unit")] session.run(*run_args) @@ -220,7 +224,11 @@ def functional(session): # Install this package. install_bezier(session, debug=True) # Run pytest against the functional tests. - run_args = ["pytest"] + session.posargs + [get_path("tests", "functional")] + run_args = ( + ["python", "-m", "pytest"] + + session.posargs + + [get_path("tests", "functional")] + ) session.run(*run_args) diff --git a/setup.py b/setup.py index a818d582..37f4611e 100644 --- a/setup.py +++ b/setup.py @@ -21,6 +21,7 @@ import pkg_resources import setuptools import setuptools.command.build_ext +import setuptools.dist VERSION = "2021.2.13.dev1" # Also in ``codemeta.json`` and ``__init__.py``. @@ -71,6 +72,7 @@ "Helper for B\u00e9zier Curves, Triangles, and Higher Order Objects" ) _IS_WINDOWS = os.name == "nt" +_IS_PYPY = sys.implementation.name == "pypy" _EXTRA_DLL = "extra-dll" _DLL_FILENAME = "bezier.dll" @@ -267,7 +269,24 @@ def setup(): ) +def _patch_setuptools(): + """Patch ``setuptools`` to address known issues. + + Known issues: + * In some PyPy installs, the ``setuptools.build_py.build_package_data()`` + method depends on the ``convert_2to3_doctests`` being set on an instance + of ``setuptools.dist.Distribution``, but it is unset. We handle this + by setting it as a **class attribute** (vs. monkey-patching ``__init__`` + to set it on instances). + """ + if not _IS_PYPY: + return + + setuptools.dist.Distribution.convert_2to3_doctests = [] + + def main(): + _patch_setuptools() setup()