jrnl-org / jrnl

Collect your thoughts and notes without leaving the command line.
https://jrnl.sh
GNU General Public License v3.0
6.46k stars 523 forks source link

Tests are failing with pytest 8.1 #1879

Open micahellison opened 6 months ago

micahellison commented 6 months ago

Tests have been working with pytest 8.0 but not pytest 8.1.1. Discovered in #1878.

A fix to this ticket:

micahellison commented 3 months ago

It looks like the output from the very first "When we run" statement is being captured, but when there are subsequent "When we run" statements in the same test, the output of those statements is no longer being captured.

It does seem related to inject_fixture in pytest bdd, since that's related to the only documented breaking change in pytest 8.1, but I'm not sure how exactly.

musicinmybrain commented 2 months ago

I’m keeping an eye on this, as we’re about to update to pytest 8.3 from 7.4.3 in Fedora Rawhide. In the short term, there are a few other packages that will need a python-pytest7 compat package, so jrnl can use that. In the medium term, it may become necessary to stop running jrnl’s tests in Fedora if this can’t be resolved.

It seemed like https://github.com/pytest-dev/pytest-bdd/issues/689 and https://github.com/pytest-dev/pytest-bdd/pull/690 could have been be related, but I tried applying that PR as a downstream patch to python-pytest-bdd and it didn’t seem to make any difference to the test failures in jrnl.

musicinmybrain commented 1 month ago

It seemed like pytest-dev/pytest-bdd#689 and pytest-dev/pytest-bdd#690 could have been be related, but I tried applying that PR as a downstream patch to python-pytest-bdd and it didn’t seem to make any difference to the test failures in jrnl.

I’m not sure if something changed, or if I tested incorrectly before, but I just tried this again (applying https://github.com/pytest-dev/pytest-bdd/pull/690 as a patch to pytest-bdd 7.2.0 and running tests from jrnl 4.1, patched with https://github.com/jrnl-org/jrnl/pull/1878, using pytest 8.3.1), and it worked. So it seems that PR is in fact the solution to this issue.