GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Merge pull request #24249 from rgommers/fix-entrypoint · numpy/numpy@1c51f77

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • numpy/tests
    • test_public_api.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎numpy/tests/test_public_api.py‎

Copy file name to clipboardExpand all lines: numpy/tests/test_public_api.py
+15-6Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -488,10 +488,7 @@ def check_importable(module_name):
488488

489489

490490
@pytest.mark.xfail(
491-
reason = "meson-python doesn't install this entrypoint correctly yet",
492-
)
493-
@pytest.mark.xfail(
494-
sysconfig.get_config_var("Py_DEBUG") is not None,
491+
sysconfig.get_config_var("Py_DEBUG") not in (None, 0, "0"),
495492
reason=(
496493
"NumPy possibly built with `USE_DEBUG=True ./tools/travis-test.sh`, "
497494
"which does not expose the `array_api` entry point. "
@@ -503,6 +500,11 @@ def test_array_api_entry_point():
503500
Entry point for Array API implementation can be found with importlib and
504501
returns the numpy.array_api namespace.
505502
"""
503+
# For a development install that did not go through meson-python,
504+
# the entrypoint will not have been installed. So ensure this test fails
505+
# only if numpy is inside site-packages.
506+
numpy_in_sitepackages = sysconfig.get_path('platlib') in np.__file__
507+
506508
eps = importlib.metadata.entry_points()
507509
try:
508510
xp_eps = eps.select(group="array_api")
@@ -512,12 +514,19 @@ def test_array_api_entry_point():
512514
# Array API entry points so that running this test in <=3.9 will
513515
# still work - see https://github.com/numpy/numpy/pull/19800.
514516
xp_eps = eps.get("array_api", [])
515-
assert len(xp_eps) > 0, "No entry points for 'array_api' found"
517+
if len(xp_eps) == 0:
518+
if numpy_in_sitepackages:
519+
msg = "No entry points for 'array_api' found"
520+
raise AssertionError(msg) from None
521+
return
516522

517523
try:
518524
ep = next(ep for ep in xp_eps if ep.name == "numpy")
519525
except StopIteration:
520-
raise AssertionError("'numpy' not in array_api entry points") from None
526+
if numpy_in_sitepackages:
527+
msg = "'numpy' not in array_api entry points"
528+
raise AssertionError(msg) from None
529+
return
521530

522531
xp = ep.load()
523532
msg = (

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.