-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[v7.0.0 regression?] AssertionError: previous item was not torn down properly #9621
Comments
I know |
It is enabled, yes. I think there's a test or two that are decorated. I will try tomorrow, it's past midnight here :) |
FWIW no issues so far with my project (qutebrowser) which uses pytest-rerunfailures. |
I've seen the same as $subject recently. So far I've narrowed it down to something to do with pytest-forked. Happy to provide more details if anyone wants! I'm curious what would happen if you temporarily did not use forked. |
It seems all affected use pytest-forked. So it's probably that, not rerunfailures.
|
It seems like pytest 7 breaks pytest-forked somehow, as also reported in pytest-dev/pytest#9621 Hence, for now pin it to any version lower than 7 to keep the unit tests working.
It seems like pytest 7 breaks pytest-forked somehow, as also reported in pytest-dev/pytest#9621 Hence, for now pin it to any version lower than 7 to keep the unit tests working.
* Make sure that tests run via make python-test are all run with '--forked' argument. * See pytest-dev/pytest-forked#67 and pytest-dev/pytest#9621 for details
* Make sure that tests run via make python-test are all run with '--forked' argument. * See pytest-dev/pytest-forked#67 and pytest-dev/pytest#9621 for details
It seems like pytest 7 breaks pytest-forked somehow, as also reported in pytest-dev/pytest#9621 Hence, for now pin it to any version lower than 7 to keep the unit tests working. (Cherry-picked from f801b69)
It seems like pytest 7 breaks pytest-forked somehow, as also reported in pytest-dev/pytest#9621 Hence, for now pin it to any version lower than 7 to keep the unit tests working. (Cherry-picked from f801b69)
It seems like pytest 7 breaks pytest-forked somehow, as also reported in pytest-dev/pytest#9621 Hence, for now pin it to any version lower than 7 to keep the unit tests working. (Cherry-picked from f801b69)
It seems like pytest 7 breaks pytest-forked somehow, as also reported in pytest-dev/pytest#9621 Hence, for now pin it to any version lower than 7 to keep the unit tests working. (Cherry-picked from f801b69)
It seems like pytest 7 breaks pytest-forked somehow, as also reported in pytest-dev/pytest#9621 Hence, for now pin it to any version lower than 7 to keep the unit tests working. (Cherry-picked from f801b69)
just a heads up: I did some digging and isolated the issue, alongside with finding a very low-effort workaround: pytest-dev/pytest-forked#67 (comment) If anyone has any ideas on how to sync |
One of the key reasons why forked is unmaintained is that setup state is a can of worms for it ever since scopes,but also then some |
Wouldn't changing the stage we customise from entirety of |
Possibly, I'm not invested in trying that Personally I hope to eventually just use xdist primitives to implement sane/safe process isolation of tests I'm not going to work out how to fix forked |
hi,Is there any solution to this problem? I also encountered the same error when using pytest7.1.2,Please give me some advice, thank you very much |
"previous item was not torn down properly" caused by mixing pytest-forked tests with non-forked tests; might be related to pytest-dev/pytest#9621
Fix: getsentry#3035 Rearrange test items so that forked tests come before normal tests within their respective modules. Swap the last forked test with the last normal test if necessary. Workaround to unpin pytest. See: pytest-dev/pytest#9621, pytest-dev/pytest-forked#67, and specifically: pytest-dev/pytest-forked#67 (comment)
Fix: getsentry#3035 Rearrange test items so that forked tests come before normal tests within their respective modules. Swap the last forked test with the last normal test if necessary. Workaround to unpin pytest. See: pytest-dev/pytest#9621, pytest-dev/pytest-forked#67, and specifically: pytest-dev/pytest-forked#67 (comment)
We use pytest-parallel and are seeing multiple random failures due to the same issue. Is there any recommendation or workaround to this issue? |
No recommendation. The fix is probably the same — move all the pytest run stages into forks or something. But I see that this project is also archived and will never get any updates unless someone forks it. |
pytest-parallel heavily hacks around in pytest internals - anything that breaks with it should be brought up to it |
I'm trying to update from pytest v6.2.5 to v7.0.0 via cherrypy/cheroot#475 and it fails the testing weirdly with $sbj.
The assertion error in question comes from the pytest's internals. Looking at the traceback promptly suggests that it's happening when one test module is being set up but the previous module hasn't been torn down completely:
pytest/src/_pytest/runner.py
Line 489 in f28421c
I don't know how it's possible so any debugging pointers are welcome. Also, I don't see this problem locally (although, I have to admit that I haven't checked all of the possible runtime combinations).
Here's what I managed to extract so far:
This is what tox has installed in the env that crashes:
python installed: attrs==21.4.0,certifi==2021.10.8,cffi==1.15.0,chardet==4.0.0,charset-normalizer==2.0.11,cheroot @ file:///home/runner/work/cheroot/cheroot/.tox/.tmp/package/2/cheroot-8.6.1.dev216%2Bgfd10ba99-py2.py3-none-any.whl,colorama==0.4.4,coverage==6.2,cryptography==36.0.1,docopt==0.6.2,execnet==1.9.0,idna==3.3,iniconfig==1.1.1,jaraco.context==4.1.1,jaraco.functools==3.5.0,jaraco.text==3.7.0,more-itertools==8.12.0,packaging==21.3,pluggy==1.0.0,portend==3.1.0,py==1.11.0,pycparser==2.21,pyOpenSSL==22.0.0,pyparsing==3.0.7,pypytools==0.6.2,pytest==7.0.0,pytest-cov==2.12.0,pytest-forked==1.4.0,pytest-mock==3.7.0,pytest-rerunfailures==10.2,pytest-sugar==0.9.4,pytest-watch==4.2.0,pytest-xdist==2.5.0,pytz==2021.3,requests==2.27.1,requests-toolbelt==0.9.1,requests-unixsocket==0.3.0,six==1.16.0,tempora==5.0.1,termcolor==1.1.0,tomli==2.0.0,trustme==0.9.0,urllib3==1.26.8,watchdog==2.1.6
plugins: xdist-2.5.0, forked-1.4.0, mock-3.7.0, sugar-0.9.4, rerunfailures-10.2, cov-2.12.0
I've seen this log on GHA under Ubuntu 20.04 and 18.04. Can't say about other envs because they've gotten canceled (will need to check separately).
I don't have a stable repro, unfortunately, but here's CI logs: https://github.com/cherrypy/cheroot/runs/5079935409.
The text was updated successfully, but these errors were encountered: