Skip to content

Commit a992b2f

Browse files
committed
Revert "chore: revert check where airmass skips on python 3.9 (#1708)"
This reverts commit b56c2af.
1 parent fddd87f commit a992b2f

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

tests/playwright/examples/test_examples.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
def test_examples(page: Page, ex_app_path: str) -> None:
1313

1414
skip_on_windows_with_timezonefinder(ex_app_path)
15+
skip_airmass_on_3_9(ex_app_path)
1516

1617
validate_example(page, ex_app_path)
1718

@@ -33,3 +34,33 @@ def skip_on_windows_with_timezonefinder(ex_app_path: str) -> None:
3334
pytest.skip(
3435
"timezonefinder has difficulty compiling on windows. Skipping example app. posit-dev/py-shiny#1651"
3536
)
37+
38+
39+
def skip_airmass_on_3_9(ex_app_path: str) -> None:
40+
print(ex_app_path)
41+
if ex_app_path != "examples/airmass/app.py":
42+
return
43+
44+
import sys
45+
46+
if sys.version_info[:2] != (3, 9):
47+
return
48+
49+
try:
50+
# Astropy loads `numpy` at run time
51+
import astropy.coordinates as _ # pyright: ignore # noqa: F401
52+
import astropy.units as __ # pyright: ignore # noqa: F401
53+
54+
# Future proofing: if astropy is _actually_ loading, raise an error
55+
raise RuntimeError(
56+
"This code believes astropy and numpy have difficulty loading on python 3.9. Please remove this check if it is no longer true."
57+
)
58+
except AttributeError as e:
59+
if "numpy" in str(e) and "product" in str(e):
60+
pytest.skip(
61+
"astropy and numpy has difficulty loading on python 3.9. Skipping example app: airmass. posit-dev/py-shiny#1678"
62+
)
63+
return
64+
65+
# Future proofing: if the error is not what we expect, raise it
66+
raise e

0 commit comments

Comments
 (0)