Opened at 2026-01-04T18:01:45Z
Last modified at 2026-01-06T21:35:53Z
#4190 assigned defect
Broken tests: failUnlessRaises has been deprecated
| Reported by: | hacklschorsch | Owned by: | hacklschorsch |
|---|---|---|---|
| Priority: | normal | Milestone: | undecided |
| Component: | unknown | Version: | n/a |
| Keywords: | Cc: | ||
| Launchpad Bug: |
Description (last modified by hacklschorsch)
failUnlessRaises has been deprecated in favor of assertRaises.
This breaks tests (see https://app.circleci.com/pipelines/github/tahoe-lafs/tahoe-lafs/5377/workflows/cd00a81d-54c3-43be-8041-719ea727c3f1).
Thanks @sajith for the pointer (both to the broken tests and the possible cause)!
2025-12-30 20:51:45 hacklschorsch sajith: thanks for your link to > https://app.circleci.com/pipelines/github/tahoe-lafs/tahoe-lafs/5377/workflows/cd00a81d-54c3-43be-8041-719ea727c3f1 2025-12-30 20:53:20 hacklschorsch Seems most failures here are due to "[...] object has no attribute 'failUnlessRaises'" - Maybe some dependency has changed? 2025-12-30 20:55:31 hacklschorsch (in the windows builds) 2025-12-30 20:55:38 hacklschorsch IIRC these worked until a while ago 2025-12-30 21:43:49 sajith hacklschorsch: I am not 100% sure right now, but I think Python (unittest module maybe?) has deprecated failUnlessRaises in favor of assertRaises or something, and I suspect that we've ended up importing failUnlessRaises both from twisted.trial.unittest and stdlib unittest. Just a hypothesis. I don't have the time to check right now.
Change History (7)
comment:1 Changed at 2026-01-04T18:40:53Z by hacklschorsch
comment:2 Changed at 2026-01-04T18:41:46Z by hacklschorsch
- Description modified (diff)
- Owner set to hacklschorsch
- Status changed from new to assigned
comment:3 Changed at 2026-01-04T19:41:56Z by hacklschorsch
- Description modified (diff)
I was able to reproduce the behavior on my NixOS development machine with a 3.13.9 CPython.
Replacing all occurrences of failUnlessRaises with assertRaises fixes this problem.
comment:4 Changed at 2026-01-04T20:08:43Z by hacklschorsch
For posterity / maybe this helps somebody sometime, I did:
python -m venv venv-3.13.9 ./venv-3.13.9/bin/pip install --editable .[test] source venv-3.13.9/bin/activate # Find a test to check if our upcoming work does help anything. # I got it from the CircleCI build job test pane. # Running this should fail: python -m twisted.trial --rterrors allmydata.test.test_hashtree.Complete # Fix the problem cd src/allmydata rg -l failUnlessRaises | xargs sed -i 's/failUnlessRaises/assertRaises/' cd ../.. # Run test again (this time it should succeed): python -m twisted.trial --rterrors allmydata.test.test_hashtree.Complete # Run all tests (to check we haven't broken something else...) python -m twisted.trial --rterrors allmydata
comment:5 Changed at 2026-01-04T20:09:59Z by hacklschorsch
I posted a fix in https://github.com/tahoe-lafs/tahoe-lafs/pull/1451.
comment:6 Changed at 2026-01-04T20:57:29Z by hacklschorsch
This also affects coverage (macos-14, 3.12) and coverage (ubuntu-22.04, 3.12).
comment:7 Changed at 2026-01-06T21:35:53Z by hacklschorsch
The cause was a change in unittest from the Python standard library.

11 tests are failing in this Server 2022 CPython 3.12 test run with AttributeError: 'Complete' object has no attribute 'failUnlessRaises' (or similar).
It seems this is not a Windows problem though, but a very-recent-python-problem:
Due to some different bug, that test suite seems to not be running CPython 3.12, but 3.13.7.