Skip to content

Fix pytest 9.1 fixture-mark import failure#687

Merged
tony merged 5 commits into
masterfrom
pytest-zsh-dep
Jun 16, 2026
Merged

Fix pytest 9.1 fixture-mark import failure#687
tony merged 5 commits into
masterfrom
pytest-zsh-dep

Conversation

@tony

@tony tony commented Jun 16, 2026

Copy link
Copy Markdown
Member

Summary

Fixes #686.

This PR keeps libtmux's zshrc fixture, but removes the pytest mark that was applied directly to the fixture function. Pytest 9.1 rejects that pattern during plugin import, before collection reaches any tests.

It also removes the project-level pytest filterwarnings block one entry at a time so pytest-facing compatibility warnings stay visible in development and CI instead of being hidden by configuration.

Upstream pytest context

Pytest documents marks on fixtures as deprecated in 7.4 and removed in 9.0:

In pytest 9.1, mark application now checks whether the target is a fixture and fails during decorator evaluation:

Reversing decorator order is not a compatible workaround, because fixture creation also rejects functions that already carry pytest marks:

Testing

  • uv run python -c 'import libtmux.pytest_plugin'
  • uv run ruff check .
  • uv run mypy
  • TMUX= TMUX_PANE= SHELL=/bin/sh uv run pytest -q -W error::pytest.PytestWarning
    • 1258 passed, 2 skipped

tony added 4 commits June 16, 2026 17:47
why: Pytest 9.1 rejects marks applied to fixture functions during
plugin import. Without this fix, libtmux's pytest plugin can fail before
collection for downstream users. The mark never affected fixture behavior,
and conftest.py already decides when to request zshrc.
what:
- Remove the skipif mark from the zshrc fixture
- Keep the fixture and USING_ZSH request path intact for zsh users
why: Project-wide ignores for libtmux deprecations can hide plugin
compatibility regressions until downstream users hit them.
what:
- Remove the filterwarnings entry that ignored libtmux deprecations
why: Test-suite deprecation warnings should stay visible so compatibility
regressions are fixed where they are introduced instead of hidden by config.
what:
- Remove the filterwarnings entry that ignored test deprecations
why: The remaining pytest warning ignore is not needed by the current suite.
Keeping warning filters in project config encourages hiding compatibility
signals.
what:
- Remove the remaining frontend.OptionParser deprecation ignore
- Drop the now-empty filterwarnings block from pytest configuration
@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 51.30%. Comparing base (025d1f2) to head (9e278f1).
⚠️ Report is 7 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #687      +/-   ##
==========================================
+ Coverage   51.29%   51.30%   +0.01%     
==========================================
  Files          25       25              
  Lines        3488     3487       -1     
  Branches      686      686              
==========================================
  Hits         1789     1789              
+ Misses       1404     1403       -1     
  Partials      295      295              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

why: Document the downstream-facing pytest 9.1 import fix for the
forthcoming 0.59.x release so users of libtmux's pytest fixtures know
the plugin loads on pytest 9.1+.
what:
- Add a Fixes entry under the 0.59.x unreleased block noting the pytest
  plugin now imports cleanly under pytest 9.1
@tony tony merged commit b709acd into master Jun 16, 2026
13 checks passed
@tony tony deleted the pytest-zsh-dep branch June 16, 2026 23:49
@tony tony restored the pytest-zsh-dep branch June 16, 2026 23:50
@tony tony deleted the pytest-zsh-dep branch June 17, 2026 00:19
tony added a commit to tmux-python/tmuxp that referenced this pull request Jun 17, 2026
Raises the libtmux floor to ~=0.58.1 so tmuxp's pytest fixtures keep
loading under pytest 9.1+. libtmux's bundled pytest plugin applied a
mark to its zshrc fixture that pytest 9.1 rejects during plugin
import — before collection — which broke test runs for any project
that loads the plugin to use tmuxp's or libtmux's fixtures. libtmux
0.58.1 fixes the mark; this floor bump pulls in that fix.

- **Dependency floor:** libtmux ~=0.58.0 -> ~=0.58.1, resolved from
  PyPI.
- **Dev toolchain:** bump the locked dev tooling, moving tmuxp's own
  test runs onto pytest 9.1.0 — the version the fix is required for.
- **Changelog:** record the floor bump and the pytest 9.1 fixture
  compatibility fix under the unreleased notes.

libtmux fix: tmux-python/libtmux#687
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.

Remove deprecated pytest mark on fixture for pytest 9.0 compatibility

1 participant