Skip to content

Fix compatibility with pytest-run-parallel and add free-threaded CI jobs#63

Merged
astrofrog merged 4 commits into
mainfrom
free-threading
Jun 2, 2026
Merged

Fix compatibility with pytest-run-parallel and add free-threaded CI jobs#63
astrofrog merged 4 commits into
mainfrom
free-threading

Conversation

@astrofrog
Copy link
Copy Markdown
Member

Without this fix, we can't run tests with pytest-run-parallel if those tests rely on pytest-arraydiff (which is used e.g. in reproject):

hook_name = 'pytest_runtest_call', hook_impl = <HookImpl plugin_name='140326316292304', plugin=<pytest_arraydiff.plugin.ArrayComparison object at 0x7fa0443c38d0>>
e = AttributeError("'NoneType' object has no attribute 'writeto'")

    def _warn_teardown_exception(
        hook_name: str, hook_impl: HookImpl, e: BaseException
    ) -> None:
        msg = "A plugin raised an exception during an old-style hookwrapper teardown.\n"
        msg += f"Plugin: {hook_impl.plugin_name}, Hook: {hook_name}\n"
        msg += f"{type(e).__name__}: {e}\n"
        msg += "For more information see https://pluggy.readthedocs.io/en/stable/api_reference.html#pluggy.PluggyTeardownRaisedWarning"  # noqa: E501
>       warnings.warn(PluggyTeardownRaisedWarning(msg), stacklevel=6)
E       pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
E       Plugin: 140326316292304, Hook: pytest_runtest_call
E       AttributeError: 'NoneType' object has no attribute 'writeto'
E       For more information see https://pluggy.readthedocs.io/en/stable/api_reference.html#pluggy.PluggyTeardownRaisedWarning

../../../python/dev/lib/python3.11/site-packages/pluggy/_callers.py:73: PluggyTeardownRaisedWarning

The fix here ensures we don't wrap the tests multiple times, and make sure we always pass output values through.

(Note: I pushed this to an upstream branch by mistake as this repo used to be under my user - will fix it for future)

… it has no free-threaded wheel and its sdist requires libhdf5-dev which CI does not install
@astrofrog astrofrog force-pushed the free-threading branch 4 times, most recently from eeb1750 to 340e541 Compare May 28, 2026 20:27
@astrofrog astrofrog requested review from bsipocz and pllim May 28, 2026 21:39
Comment thread .github/workflows/ci_workflows.yml Outdated
Comment on lines +34 to +35
- linux: py313t-test
- linux: py313t-test-parallel
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest going straight to 314t here:

  • 3.13t was always experimental
  • cibuildwheel is currently sunsetting it so it seems unlikely that tables will ever support it

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread tests/test_pytest_arraydiff.py Outdated
gen_dir = os.path.join(tmpdir, 'reference')

# Generate the reference file first
code = subprocess.call(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this use the builtin pytester fixture instead ? https://docs.pytest.org/en/stable/reference/reference.html#std-fixture-pytester

It does require pytest>=6.2, which is very reasonable now IMO (6.2 came out in 2020)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread tests/test_pytest_arraydiff.py Outdated
Comment thread setup.cfg Outdated
numpy

# tables limitation is until 3.9.3 is out as that supports ARM OSX.
# tables limitation is until 3.9.3 is out as that supports ARM OSX, and
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this additional comment is particularly helpful here; it'd be much more fitting in tox.ini

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread tox.ini Outdated
Comment thread pytest_arraydiff/plugin.py Outdated
Comment on lines +387 to +388
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_call(self, item):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this implementation now exactly equivalent to the default ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

astrofrog and others added 2 commits June 2, 2026 10:39
Co-authored-by: Clément Robert <cr52@protonmail.com>
…the pytester fixture with a pytest 6.2 minimum, testing free-threaded Python 3.14 instead of 3.13, trimming the tables comment in setup.cfg, and dropping the redundant array interceptor hook
@astrofrog astrofrog requested a review from neutrinoceros June 2, 2026 10:26
@astrofrog astrofrog merged commit 287eac5 into main Jun 2, 2026
34 checks passed
@pllim pllim deleted the free-threading branch June 2, 2026 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants