python-poetry / python-poetry/poetry
`test_threading_*` are inconsistent, race condition?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 34.3k
- Forks
- 2.5k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 30
Description
Description
Relates-to: #3155
I am trying to build poetry-2.1.2 with Nix. However, when Nix runs the tests through pytest, the threading tests only work sometimes.
Locally, I had a build which succeeded but also a build with 1 failing test:
FAILED tests/utils/test_threading.py::test_threading_atomic_cached_property_different_instances[value_functools_cached_property-32] - AssertionError: assert 21 == 32
On Hydra, the NixOS CI all four of the tests in test_threading.py failed (full build log, relevant part starts at Executing pytestCheckPhase):
FAILED tests/utils/test_threading.py::test_threading_property_caching[value_functools_cached_property-100] - AssertionError: assert 27 == 100
FAILED tests/utils/test_threading.py::test_threading_property_caching[value_functools_cache-100] - AssertionError: assert 37 == 100
FAILED tests/utils/test_threading.py::test_threading_atomic_cached_property_different_instances[value_functools_cached_property-200] - AssertionError: assert 127 == 200
FAILED tests/utils/test_threading.py::test_threading_atomic_cached_property_different_instances[value_functools_cache-200] - AssertionError: assert 39 == 200
How to reproduce
If you have Nix installed, you can do:
$ nix build --extra-experimental-features "nix-command flakes" \
github:nixos/nixpkgs/89159c150e0475861ab87af67676c738d478915d#poetry \
--keep-failed
Workarounds
In the nix build recipe, one could add:
disabledTests = [
"test_threading_property_types"
"test_threading_single_thread_safe"
"test_threading_property_caching"
"test_threading_atomic_cached_property_different_instances"
];
Which is what I'll submit a PR for there downsteam, but I think this issue might still be relevant to this repository, as it seems like these tests are a bit flaky.
Poetry Installation Method
system package manager (eg: dnf, apt etc.)
Operating System
NixOS 25.05 (Warbler) x86_64
Poetry Version
2.1.2
Poetry Configuration
N/A
Python Sysconfig
Github doesn't allow me to upload it fully because it's too big: https://pastebin.com/6DJ3VJZF
Example pyproject.toml
N/A
Poetry Runtime Logs
N/A
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with tests/utils/test_threading.py and run the four named tests under pytest, reproducing the Nix build if available. Compare the observed assertion counts with the issue's local and Hydra failures, then trace the threading test behavior. Done means the tests reliably pass under the affected environment or the flaky behavior and required fix are clearly established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100