twisted.protocols.policies.TimeoutMixin does not accept a reactor on its constructor.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 6k
- Forks
- 1.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 10
Description
| @Lukasa reported | |
|---|---|
| Trac ID | trac#8488 |
| Type | enhancement |
| Created | 2016-06-20 08:55:06Z |
Encountered while writing tests for #8481.
TimeoutMixin is a useful feature, however it makes testing somewhat awkward. This is because it implements its functionality using reactor.callLater. Obviously, for testing this it's not ideal to wait around an actual amount of time, so we'd like to use twisted.internet.task.Clock in this case. Unfortunately, the callLater method on TimeoutMixin always calls reactor.callLater on the reactor returned by running from twisted.internet import reactor. This is really frustrating, because it forces us to patch the callLater method to point to our inserted reactor.
This is doubly problematic outside of the testing ecosystem: given that most classes (e.g. H2Connection) allow you to pass a reactor into them, it's going to surprise people that if those classes support a mixin like TimeoutMixin that the timeouts will not respect the explicit reactor.
Searchable metadata
trac-id__8488 8488
type__enhancement enhancement
reporter__Lukasa Lukasa
priority__normal normal
milestone__None None
branch__
branch_author__
status__new new
resolution__None None
component__core core
keywords__None None
time__1466412906984308 1466412906984308
changetime__1485395051298639 1485395051298639
version__None None
owner__None None
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 at TimeoutMixin and trace its callLater path, then review twisted.internet.task.Clock and the tests associated with issue #8481. Done means TimeoutMixin accepts an explicit reactor, uses it for timeout scheduling, and has tests that avoid waiting on real time.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100