|
1 | 1 | import os |
2 | | -import sys |
3 | 2 | import warnings |
4 | 3 | from importlib import import_module |
5 | 4 | from pathlib import Path |
@@ -36,47 +35,6 @@ def import_pandas(): |
36 | 35 | pytest.skip("Couldn't import pandas") |
37 | 36 |
|
38 | 37 |
|
39 | | -@pytest.hookimpl(hookwrapper=True) |
40 | | -def pytest_runtest_call(item): |
41 | | - """Convert missing pyarrow imports to skips. |
42 | | -
|
43 | | - TODO(evertlammerts): Remove skip when pyarrow releases for 3.14. |
44 | | - https://github.com/duckdblabs/duckdb-internal/issues/6182 |
45 | | - """ |
46 | | - outcome = yield |
47 | | - if sys.version_info[:2] == (3, 14): |
48 | | - try: |
49 | | - outcome.get_result() |
50 | | - except ImportError as e: |
51 | | - if e.name == "pyarrow": |
52 | | - pytest.skip(f"pyarrow not available - {item.name} requires pyarrow") |
53 | | - else: |
54 | | - raise |
55 | | - |
56 | | - |
57 | | -@pytest.hookimpl(hookwrapper=True) |
58 | | -def pytest_make_collect_report(collector): |
59 | | - """Wrap module collection to catch pyarrow import errors on Python 3.14. |
60 | | -
|
61 | | - If we're on Python 3.14 and a test module raises ModuleNotFoundError |
62 | | - for 'pyarrow', mark the entire module as xfailed rather than failing collection. |
63 | | -
|
64 | | - TODO(evertlammerts): Remove skip when pyarrow releases for 3.14. |
65 | | - https://github.com/duckdblabs/duckdb-internal/issues/6182 |
66 | | - """ |
67 | | - outcome = yield |
68 | | - report: pytest.CollectReport = outcome.get_result() |
69 | | - |
70 | | - if sys.version_info[:2] == (3, 14): |
71 | | - # Only handle failures from module collectors |
72 | | - if report.failed and collector.__class__.__name__ == "Module": |
73 | | - longreprtext = report.longreprtext |
74 | | - if "ModuleNotFoundError: No module named 'pyarrow'" in longreprtext: |
75 | | - report.outcome = "skipped" |
76 | | - reason = f"XFAIL: [pyarrow not available] {longreprtext}" |
77 | | - report.longrepr = (report.fspath, None, reason) |
78 | | - |
79 | | - |
80 | 38 | # https://docs.pytest.org/en/latest/example/simple.html#control-skipping-of-tests-according-to-command-line-option |
81 | 39 | # https://stackoverflow.com/a/47700320 |
82 | 40 | def pytest_addoption(parser): |
|
0 commit comments