Skip to content

Commit

Permalink
Small tooling updates for using PyPy locally.
Browse files Browse the repository at this point in the history
  • Loading branch information
dhermes committed Nov 29, 2021
1 parent 2143861 commit 210dfea
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
16 changes: 12 additions & 4 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)


Expand All @@ -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)
Expand All @@ -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)


Expand Down
19 changes: 19 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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``.
Expand Down Expand Up @@ -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"

Expand Down Expand Up @@ -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()


Expand Down

0 comments on commit 210dfea

Please sign in to comment.