Ticket #2937 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

parameterize reactor in twisted.application.internet services

Reported by: exarkun Owned by: therve
Priority: highest Milestone:
Component: core Keywords:
Cc: therve Branch: branches/service-reactor-2937
Author: therve Launchpad Bug:

Description

The unpleasant way ports are bound and connections are made by the internet services means that it is difficult or impossible to test this code without actually hitting the network. This is likewise for application code (such as makeService implementations) which creates these objects.

It should be possible to specify the reactor used by these classes.

Change History

Changed 3 years ago by therve

  • branch set to branches/service-reactor-2937
  • author set to therve

(In [22037]) Branching to 'service-reactor-2937'

Changed 3 years ago by therve

(In [22038]) Make reactor parametrizable in clients and servers.

Refs #2937

Changed 3 years ago by therve

  • keywords review added
  • cc therve added
  • owner glyph deleted
  • priority changed from normal to highest

This is ready to review!

Changed 3 years ago by exarkun

  • owner set to therve
  • keywords review removed

The implementations of _getPort and _getConnection won't work as expected the second time they're invoked (eg, startService, stopService, startService).

I guess there should be some test coverage for the repeated use of the same service object.

Changed 3 years ago by therve

(In [22051]) Remove the 'reactor' keyword in init, add tests for multiple start, some docs.

Refs #2937

Changed 3 years ago by therve

  • owner therve deleted
  • keywords review added

Oups, thanks, I had missed that. Back to review.

Changed 3 years ago by exarkun

  • owner set to therve
  • keywords review removed

pyflakes warnings on test_application.py:

  • twisted/test/test_application.py:20: 'microdom' imported but unused
  • twisted/test/test_application.py:591: redefinition of fuction 'test_reactorParametrizationInClient' from line 553

_getPort and _getConnection could probably use some docstrings.

Other than those issues, I think it looks good. No need for re-review unless you notice something else.

Changed 3 years ago by therve

(In [22161]) Rename a test, add some docstrings to internal methods.

Refs #2937

Changed 3 years ago by therve

  • status changed from new to closed
  • resolution set to fixed

(In [22163]) Merge service-reactor-2937

Author: therve Reviewer: exarkun Fixes #2937

Add a reactor keyword for services in twisted.application.internet so that we can test this code more easily without hitting the network.

Note: See TracTickets for help on using tickets.