Repository: twisted/twisted

Issue:
[meta] Remove DeprecationWarning from twisted own tests
|[<img alt="adiroiban's avatar" src="https://avatars.githubusercontent.com/u/204609?s=50" width="50" height="50">](https://github.com/adiroiban)| @adiroiban reported|
|-|-|
|Trac ID|trac#10149|
|Type|task|
|Created|2021-03-23 23:26:21Z|

The twisted own test suite should not use deprecated code.

My reasoning is as follows.

When a PR is  created to deprecated some API, the PR will take care of replacing all usage of that API in Twisted itself.

Then, when it's time to remove the deprecated API, the PR to remove the code will just need to remove the API and will not have to see how to replace the API in the current code base.

Later, we might have a CI check to make sure the test will not introduce new DeprecationsWarnings

This is the meta ticket which shows the current state.

Separeate tickets should be created for each deprecated API/warning


```
$ python3 -Wall -m twisted.trial -n twisted > /dev/null


/home/adi/chevah/twisted/.tox/build3/lib/python3.9/site-packages/unittest2/compatibility.py:143: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working
  class ChainMap(collections.MutableMapping):
/home/adi/chevah/twisted/src/twisted/application/test/test_internet.py:38: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import StringTransport
/home/adi/chevah/twisted/src/twisted/application/twist/test/test_options.py:22: DeprecationWarning: twisted.test.proto_helpers.MemoryReactor was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.MemoryReactor instead.
  from twisted.test.proto_helpers import MemoryReactor
/home/adi/chevah/twisted/src/twisted/application/twist/test/test_twist.py:13: DeprecationWarning: twisted.test.proto_helpers.MemoryReactor was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.MemoryReactor instead.
  from twisted.test.proto_helpers import MemoryReactor
/home/adi/chevah/twisted/src/twisted/test/test_twistd.py:42: DeprecationWarning: twisted.test.proto_helpers.MemoryReactor was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.MemoryReactor instead.
  from twisted.test.proto_helpers import MemoryReactor
/home/adi/chevah/twisted/src/twisted/conch/test/test_cftp.py:33: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import StringTransport
/home/adi/chevah/twisted/src/twisted/conch/test/test_channel.py:19: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import StringTransport
/home/adi/chevah/twisted/src/twisted/conch/scripts/ckeygen.py:15: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  from imp import reload
/home/adi/chevah/twisted/src/twisted/conch/test/test_default.py:17: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import StringTransport
/home/adi/chevah/twisted/src/twisted/conch/test/test_endpoints.py:29: DeprecationWarning: twisted.test.proto_helpers.EventLoggingObserver was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.EventLoggingObserver instead.
  from twisted.test.proto_helpers import EventLoggingObserver, MemoryReactorClock
/home/adi/chevah/twisted/src/twisted/conch/test/test_endpoints.py:29: DeprecationWarning: twisted.test.proto_helpers.MemoryReactorClock was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.MemoryReactorClock instead.
  from twisted.test.proto_helpers import EventLoggingObserver, MemoryReactorClock
/home/adi/chevah/twisted/src/twisted/conch/test/test_endpoints.py:80: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import StringTransport
/home/adi/chevah/twisted/src/twisted/conch/test/test_forwarding.py:18: DeprecationWarning: twisted.test.proto_helpers.MemoryReactorClock was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.MemoryReactorClock instead.
  from twisted.test.proto_helpers import MemoryReactorClock, StringTransport
/home/adi/chevah/twisted/src/twisted/conch/test/test_forwarding.py:18: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import MemoryReactorClock, StringTransport
/home/adi/chevah/twisted/src/twisted/conch/test/test_insults.py:8: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import StringTransport
/home/adi/chevah/twisted/src/twisted/conch/test/test_manhole.py:18: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import StringTransport
/home/adi/chevah/twisted/src/twisted/conch/test/test_recvline.py:23: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import StringTransport
/home/adi/chevah/twisted/src/twisted/conch/test/test_mixin.py:6: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import StringTransport
/home/adi/chevah/twisted/src/twisted/test/test_tcp.py:29: DeprecationWarning: twisted.test.proto_helpers.AccumulatingProtocol was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.AccumulatingProtocol instead.
  from twisted.test.proto_helpers import AccumulatingProtocol
/home/adi/chevah/twisted/src/twisted/internet/test/test_tcp.py:95: DeprecationWarning: twisted.test.proto_helpers.MemoryReactor was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.MemoryReactor instead.
  from twisted.test.proto_helpers import MemoryReactor, StringTransport
/home/adi/chevah/twisted/src/twisted/internet/test/test_tcp.py:95: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import MemoryReactor, StringTransport
/home/adi/chevah/twisted/src/twisted/internet/test/test_protocol.py:31: DeprecationWarning: twisted.test.proto_helpers.MemoryReactorClock was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.MemoryReactorClock instead.
  from twisted.test.proto_helpers import MemoryReactorClock, StringTransport
/home/adi/chevah/twisted/src/twisted/internet/test/test_protocol.py:31: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import MemoryReactorClock, StringTransport
/home/adi/chevah/twisted/src/twisted/mail/test/test_imap.py:53: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import StringTransport, StringTransportWithDisconnection
/home/adi/chevah/twisted/src/twisted/mail/test/test_imap.py:53: DeprecationWarning: twisted.test.proto_helpers.StringTransportWithDisconnection was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransportWithDisconnection instead.
  from twisted.test.proto_helpers import StringTransport, StringTransportWithDisconnection
/home/adi/chevah/twisted/src/twisted/mail/test/test_mail.py:53: DeprecationWarning: twisted.test.proto_helpers.LineSendingProtocol was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.LineSendingProtocol instead.
  from twisted.test.proto_helpers import (
/home/adi/chevah/twisted/src/twisted/mail/test/test_mail.py:53: DeprecationWarning: twisted.test.proto_helpers.MemoryReactorClock was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.MemoryReactorClock instead.
  from twisted.test.proto_helpers import (
/home/adi/chevah/twisted/src/twisted/mail/test/test_mail.py:53: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import (
/home/adi/chevah/twisted/src/twisted/mail/test/test_mailmail.py:22: DeprecationWarning: twisted.test.proto_helpers.MemoryReactor was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.MemoryReactor instead.
  from twisted.test.proto_helpers import MemoryReactor
/home/adi/chevah/twisted/src/twisted/mail/test/test_pop3.py:26: DeprecationWarning: twisted.test.proto_helpers.LineSendingProtocol was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.LineSendingProtocol instead.
  from twisted.test.proto_helpers import LineSendingProtocol
/home/adi/chevah/twisted/src/twisted/mail/test/test_pop3client.py:21: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import StringTransport
/home/adi/chevah/twisted/src/twisted/mail/test/test_smtp.py:24: DeprecationWarning: twisted.test.proto_helpers.MemoryReactor was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.MemoryReactor instead.
  from twisted.test.proto_helpers import MemoryReactor, StringTransport
/home/adi/chevah/twisted/src/twisted/mail/test/test_smtp.py:24: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import MemoryReactor, StringTransport
/home/adi/chevah/twisted/src/twisted/names/test/test_names.py:29: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import (
/home/adi/chevah/twisted/src/twisted/names/test/test_names.py:29: DeprecationWarning: twisted.test.proto_helpers.MemoryReactorClock was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.MemoryReactorClock instead.
  from twisted.test.proto_helpers import (
/home/adi/chevah/twisted/src/twisted/names/test/test_names.py:29: DeprecationWarning: twisted.test.proto_helpers.waitUntilAllDisconnected was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.waitUntilAllDisconnected instead.
  from twisted.test.proto_helpers import (
/home/adi/chevah/twisted/src/twisted/names/test/test_srvconnect.py:21: DeprecationWarning: twisted.test.proto_helpers.MemoryReactor was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.MemoryReactor instead.
  from twisted.test.proto_helpers import MemoryReactor
/home/adi/chevah/twisted/src/twisted/protocols/haproxy/test/test_parser.py:9: DeprecationWarning: twisted.test.proto_helpers.MemoryReactor was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.MemoryReactor instead.
  from twisted.test.proto_helpers import MemoryReactor
/home/adi/chevah/twisted/src/twisted/protocols/haproxy/test/test_wrapper.py:11: DeprecationWarning: twisted.test.proto_helpers.StringTransportWithDisconnection was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransportWithDisconnection instead.
  from twisted.test.proto_helpers import StringTransportWithDisconnection
/home/adi/chevah/twisted/src/twisted/protocols/test/test_tls.py:66: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import StringTransport, NonStreamingProducer
/home/adi/chevah/twisted/src/twisted/protocols/test/test_tls.py:66: DeprecationWarning: twisted.test.proto_helpers.NonStreamingProducer was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.NonStreamingProducer instead.
  from twisted.test.proto_helpers import StringTransport, NonStreamingProducer
/home/adi/chevah/twisted/src/twisted/runner/test/test_procmon.py:15: DeprecationWarning: twisted.test.proto_helpers.MemoryReactor was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.MemoryReactor instead.
  from twisted.test.proto_helpers import MemoryReactor
/home/adi/chevah/twisted/src/twisted/spread/test/test_banana.py:14: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import StringTransport
/home/adi/chevah/twisted/src/twisted/spread/test/test_jelly.py:16: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import StringTransport
/home/adi/chevah/twisted/src/twisted/spread/test/test_pb.py:37: DeprecationWarning: twisted.test.proto_helpers._FakeConnector was deprecated in Twisted 19.7.0: Please use twisted.internet.testing._FakeConnector instead.
  from twisted.test.proto_helpers import _FakeConnector
/home/adi/chevah/twisted/src/twisted/test/test_amp.py:23: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import StringTransport
/home/adi/chevah/twisted/src/twisted/test/test_application.py:31: DeprecationWarning: twisted.test.proto_helpers.MemoryReactor was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.MemoryReactor instead.
  from twisted.test.proto_helpers import MemoryReactor
/home/adi/chevah/twisted/src/twisted/test/test_dict.py:7: DeprecationWarning: twisted.protocols.dict was deprecated in Twisted 17.9.0: There is no replacement for this module.
  from twisted.protocols import dict
/home/adi/chevah/twisted/src/twisted/test/test_finger.py:10: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import StringTransport
/home/adi/chevah/twisted/src/twisted/test/test_ident.py:19: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import StringTransport
/home/adi/chevah/twisted/src/twisted/test/test_memcache.py:15: DeprecationWarning: twisted.test.proto_helpers.StringTransportWithDisconnection was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransportWithDisconnection instead.
  from twisted.test.proto_helpers import StringTransportWithDisconnection
/home/adi/chevah/twisted/src/twisted/test/test_policies.py:14: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import StringTransport
/home/adi/chevah/twisted/src/twisted/test/test_policies.py:15: DeprecationWarning: twisted.test.proto_helpers.StringTransportWithDisconnection was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransportWithDisconnection instead.
  from twisted.test.proto_helpers import StringTransportWithDisconnection
/home/adi/chevah/twisted/src/twisted/test/test_postfix.py:11: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import StringTransport
/home/adi/chevah/twisted/src/twisted/test/test_ssl.py:15: DeprecationWarning: twisted.test.proto_helpers.waitUntilAllDisconnected was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.waitUntilAllDisconnected instead.
  from twisted.test.proto_helpers import waitUntilAllDisconnected
/home/adi/chevah/twisted/src/twisted/trial/_dist/test/test_disttrial.py:21: DeprecationWarning: twisted.test.proto_helpers.MemoryReactorClock was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.MemoryReactorClock instead.
  from twisted.test.proto_helpers import MemoryReactorClock
/home/adi/chevah/twisted/src/twisted/trial/_dist/test/test_worker.py:24: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import StringTransport
/home/adi/chevah/twisted/src/twisted/trial/_dist/test/test_workertrial.py:15: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import StringTransport
/usr/lib/python3.9/inspect.py:351: DeprecationWarning: twisted.trial.test.test_assertions.somethingOld was deprecated in Bar 1.2.3: It's old and clunky
  value = getattr(object, key)
/home/adi/chevah/twisted/src/twisted/web/test/test_agent.py:23: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import (
/home/adi/chevah/twisted/src/twisted/web/test/test_agent.py:23: DeprecationWarning: twisted.test.proto_helpers.MemoryReactorClock was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.MemoryReactorClock instead.
  from twisted.test.proto_helpers import (
/home/adi/chevah/twisted/src/twisted/web/test/test_agent.py:23: DeprecationWarning: twisted.test.proto_helpers.EventLoggingObserver was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.EventLoggingObserver instead.
  from twisted.test.proto_helpers import (
/home/adi/chevah/twisted/src/twisted/web/test/test_agent.py:63: DeprecationWarning: twisted.test.proto_helpers.AccumulatingProtocol was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.AccumulatingProtocol instead.
  from twisted.test.proto_helpers import AccumulatingProtocol
/home/adi/chevah/twisted/src/twisted/web/test/test_web.py:27: DeprecationWarning: twisted.test.proto_helpers.EventLoggingObserver was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.EventLoggingObserver instead.
  from twisted.test.proto_helpers import EventLoggingObserver
/home/adi/chevah/twisted/src/twisted/web/test/test_http.py:42: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import (
/home/adi/chevah/twisted/src/twisted/web/test/test_http.py:42: DeprecationWarning: twisted.test.proto_helpers.NonStreamingProducer was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.NonStreamingProducer instead.
  from twisted.test.proto_helpers import (
/home/adi/chevah/twisted/src/twisted/web/test/test_http.py:42: DeprecationWarning: twisted.test.proto_helpers.EventLoggingObserver was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.EventLoggingObserver instead.
  from twisted.test.proto_helpers import (
/home/adi/chevah/twisted/src/twisted/web/test/test_httpauth.py:35: DeprecationWarning: twisted.test.proto_helpers.EventLoggingObserver was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.EventLoggingObserver instead.
  from twisted.test.proto_helpers import EventLoggingObserver
/home/adi/chevah/twisted/src/twisted/web/test/test_newclient.py:20: DeprecationWarning: twisted.test.proto_helpers.AccumulatingProtocol was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.AccumulatingProtocol instead.
  from twisted.test.proto_helpers import (
/home/adi/chevah/twisted/src/twisted/web/test/test_newclient.py:20: DeprecationWarning: twisted.test.proto_helpers.EventLoggingObserver was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.EventLoggingObserver instead.
  from twisted.test.proto_helpers import (
/home/adi/chevah/twisted/src/twisted/web/test/test_newclient.py:20: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import (
/home/adi/chevah/twisted/src/twisted/web/test/test_newclient.py:20: DeprecationWarning: twisted.test.proto_helpers.StringTransportWithDisconnection was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransportWithDisconnection instead.
  from twisted.test.proto_helpers import (
/home/adi/chevah/twisted/src/twisted/web/test/test_proxy.py:9: DeprecationWarning: twisted.test.proto_helpers.StringTransportWithDisconnection was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransportWithDisconnection instead.
  from twisted.test.proto_helpers import StringTransportWithDisconnection
/home/adi/chevah/twisted/src/twisted/web/test/test_proxy.py:10: DeprecationWarning: twisted.test.proto_helpers.MemoryReactor was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.MemoryReactor instead.
  from twisted.test.proto_helpers import MemoryReactor
/home/adi/chevah/twisted/src/twisted/web/test/test_template.py:29: DeprecationWarning: twisted.test.proto_helpers.EventLoggingObserver was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.EventLoggingObserver instead.
  from twisted.test.proto_helpers import EventLoggingObserver
/home/adi/chevah/twisted/src/twisted/web/test/test_webclient.py:25: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import (
/home/adi/chevah/twisted/src/twisted/web/test/test_webclient.py:25: DeprecationWarning: twisted.test.proto_helpers.waitUntilAllDisconnected was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.waitUntilAllDisconnected instead.
  from twisted.test.proto_helpers import (
/home/adi/chevah/twisted/src/twisted/web/test/test_webclient.py:25: DeprecationWarning: twisted.test.proto_helpers.EventLoggingObserver was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.EventLoggingObserver instead.
  from twisted.test.proto_helpers import (
/home/adi/chevah/twisted/src/twisted/web/test/test_webclient.py:1631: DeprecationWarning: twisted.web.client.HTTPPageGetter was deprecated in Twisted 16.7.0: please use https://pypi.org/project/treq/ or twisted.web.client.Agent instead
  protocolClass = client.HTTPPageGetter
/home/adi/chevah/twisted/src/twisted/web/test/test_webclient.py:1660: DeprecationWarning: twisted.web.client.HTTPPageGetter was deprecated in Twisted 16.7.0: please use https://pypi.org/project/treq/ or twisted.web.client.Agent instead
  protocolClass = client.HTTPPageGetter
/home/adi/chevah/twisted/src/twisted/web/test/test_webclient.py:1689: DeprecationWarning: twisted.web.client.HTTPPageDownloader was deprecated in Twisted 16.7.0: please use https://pypi.org/project/treq/ or twisted.web.client.Agent instead
  protocolClass = client.HTTPPageDownloader
/home/adi/chevah/twisted/src/twisted/web/test/test_webclient.py:1697: DeprecationWarning: twisted.web.client.HTTPPageDownloader was deprecated in Twisted 16.7.0: please use https://pypi.org/project/treq/ or twisted.web.client.Agent instead
  protocolClass = client.HTTPPageDownloader
/home/adi/chevah/twisted/src/twisted/web/test/test_wsgi.py:29: DeprecationWarning: twisted.test.proto_helpers.EventLoggingObserver was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.EventLoggingObserver instead.
  from twisted.test.proto_helpers import EventLoggingObserver
/home/adi/chevah/twisted/src/twisted/web/test/test_xmlrpc.py:25: DeprecationWarning: twisted.test.proto_helpers.MemoryReactor was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.MemoryReactor instead.
  from twisted.test.proto_helpers import MemoryReactor, EventLoggingObserver
/home/adi/chevah/twisted/src/twisted/web/test/test_xmlrpc.py:25: DeprecationWarning: twisted.test.proto_helpers.EventLoggingObserver was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.EventLoggingObserver instead.
  from twisted.test.proto_helpers import MemoryReactor, EventLoggingObserver
/home/adi/chevah/twisted/src/twisted/words/test/test_irc.py:14: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import StringTransport, StringIOWithoutClosing
/home/adi/chevah/twisted/src/twisted/words/test/test_irc.py:14: DeprecationWarning: twisted.test.proto_helpers.StringIOWithoutClosing was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringIOWithoutClosing instead.
  from twisted.test.proto_helpers import StringTransport, StringIOWithoutClosing
/home/adi/chevah/twisted/src/twisted/words/test/test_ircsupport.py:8: DeprecationWarning: twisted.test.proto_helpers.StringTransport was deprecated in Twisted 19.7.0: Please use twisted.internet.testing.StringTransport instead.
  from twisted.test.proto_helpers import StringTransport
```



<details><summary>Searchable metadata</summary>

```
trac-id__10149 10149
type__task task
reporter__adiroiban adiroiban
priority__normal normal
milestone__None None
branch__ 
branch_author__ 
status__new new
resolution__None None
component__core core
keywords__None None
time__1616541981031497 1616541981031497
changetime__1617909473376350 1617909473376350
version__None None
owner__None None

```
</details>



Discussion:
|[<img alt="wiml's avatar" src="https://avatars.githubusercontent.com/u/156891?s=50" width="50" height="50">](https://github.com/wiml)<a name="note_1"></a>|@wiml commented|
|-|-|

I think a slightly different approach would be better. When Twisted deprecates some public api, it should of course no longer use that code itself. But the now-deprecated code will (hopefully) have tests which exercised it. *Those* tests should remain, but should be updated to assert that they elicit the expected deprecation warnings. (Perhaps as simple as adding a decorator to the test function.) Other than the (pre-existing) unit tests, of course, nothing in Twisted should be calling into the deprecated code.

Why I like this approach: it's a common pattern to hollow-out a deprecated API so it just calls the replacement API. But we want to ensure that we don't break users of Twisted until *after* the deprecation period ends and we actually remove the API. Keeping the original tests around helps ensure that we don't break the API without giving users a chance to migrate off of it.

Resolving patch:
diff --git a/src/twisted/conch/scripts/ckeygen.py b/src/twisted/conch/scripts/ckeygen.py
--- a/src/twisted/conch/scripts/ckeygen.py
+++ b/src/twisted/conch/scripts/ckeygen.py
@@ -14,7 +14,7 @@
 import sys
 from collections.abc import Callable
 from functools import wraps
-from imp import reload
+from importlib import reload
 from typing import Any, Dict, Optional
 
 from twisted.conch.ssh import keys
diff --git a/src/twisted/python/rebuild.py b/src/twisted/python/rebuild.py
--- a/src/twisted/python/rebuild.py
+++ b/src/twisted/python/rebuild.py
@@ -13,7 +13,7 @@
 import sys
 import time
 import types
-from imp import reload
+from importlib import reload
 from types import ModuleType
 from typing import Dict
 


Test patch:
diff --git a/src/twisted/application/test/test_internet.py b/src/twisted/application/test/test_internet.py
--- a/src/twisted/application/test/test_internet.py
+++ b/src/twisted/application/test/test_internet.py
@@ -32,9 +32,9 @@
 )
 from twisted.internet.protocol import Factory, Protocol
 from twisted.internet.task import Clock
+from twisted.internet.testing import StringTransport
 from twisted.logger import formatEvent, globalLogPublisher
 from twisted.python.failure import Failure
-from twisted.test.proto_helpers import StringTransport
 from twisted.trial.unittest import SynchronousTestCase, TestCase
 
 
diff --git a/src/twisted/application/twist/test/test_options.py b/src/twisted/application/twist/test/test_options.py
--- a/src/twisted/application/twist/test/test_options.py
+++ b/src/twisted/application/twist/test/test_options.py
@@ -12,6 +12,7 @@
 from twisted.copyright import version
 from twisted.internet import reactor
 from twisted.internet.interfaces import IReactorCore
+from twisted.internet.testing import MemoryReactor
 from twisted.logger import (
     FileLogObserver,
     LogLevel,
@@ -19,7 +20,6 @@
     textFileLogObserver,
 )
 from twisted.python.usage import UsageError
-from twisted.test.proto_helpers import MemoryReactor
 from ...reactors import NoSuchReactor
 from ...runner._exit import ExitStatus
 from ...runner.test.test_runner import DummyExit
diff --git a/src/twisted/application/twist/test/test_twist.py b/src/twisted/application/twist/test/test_twist.py
--- a/src/twisted/application/twist/test/test_twist.py
+++ b/src/twisted/application/twist/test/test_twist.py
@@ -10,8 +10,8 @@
 
 import twisted.trial.unittest
 from twisted.internet.interfaces import IReactorCore
+from twisted.internet.testing import MemoryReactor
 from twisted.logger import LogLevel, jsonFileLogObserver
-from twisted.test.proto_helpers import MemoryReactor
 from twisted.test.test_twistd import SignalCapturingMemoryReactor
 from ...runner._exit import ExitStatus
 from ...runner._runner import Runner
diff --git a/src/twisted/conch/test/test_cftp.py b/src/twisted/conch/test/test_cftp.py
--- a/src/twisted/conch/test/test_cftp.py
+++ b/src/twisted/conch/test/test_cftp.py
@@ -24,13 +24,13 @@
 from twisted.cred import portal
 from twisted.internet import defer, error, interfaces, protocol, reactor
 from twisted.internet.task import Clock
+from twisted.internet.testing import StringTransport
 from twisted.internet.utils import getProcessOutputAndValue, getProcessValue
 from twisted.python import log
 from twisted.python.fakepwd import UserDatabase
 from twisted.python.filepath import FilePath
 from twisted.python.procutils import which
 from twisted.python.reflect import requireModule
-from twisted.test.proto_helpers import StringTransport
 from twisted.trial.unittest import TestCase
 
 pyasn1 = requireModule("pyasn1")
diff --git a/src/twisted/conch/test/test_channel.py b/src/twisted/conch/test/test_channel.py
--- a/src/twisted/conch/test/test_channel.py
+++ b/src/twisted/conch/test/test_channel.py
@@ -17,7 +17,7 @@
     from twisted.conch.ssh.transport import SSHServerTransport
     from twisted.internet import interfaces
     from twisted.internet.address import IPv4Address
-    from twisted.test.proto_helpers import StringTransport
+    from twisted.internet.testing import StringTransport
 
     skipTest = ""
 except ImportError:
diff --git a/src/twisted/conch/test/test_default.py b/src/twisted/conch/test/test_default.py
--- a/src/twisted/conch/test/test_default.py
+++ b/src/twisted/conch/test/test_default.py
@@ -11,11 +11,11 @@
 
 from twisted.conch.error import ConchError
 from twisted.conch.test import keydata
+from twisted.internet.testing import StringTransport
 from twisted.python.compat import nativeString
 from twisted.python.filepath import FilePath
 from twisted.python.reflect import requireModule
 from twisted.python.runtime import platform
-from twisted.test.proto_helpers import StringTransport
 from twisted.trial.unittest import TestCase
 
 doSkip = False
diff --git a/src/twisted/conch/test/test_endpoints.py b/src/twisted/conch/test/test_endpoints.py
--- a/src/twisted/conch/test/test_endpoints.py
+++ b/src/twisted/conch/test/test_endpoints.py
@@ -28,13 +28,17 @@
 )
 from twisted.internet.interfaces import IAddress, IStreamClientEndpoint
 from twisted.internet.protocol import Factory, Protocol
+from twisted.internet.testing import (
+    EventLoggingObserver,
+    MemoryReactorClock,
+    StringTransport,
+)
 from twisted.logger import LogLevel, globalLogPublisher
 from twisted.python.compat import networkString
 from twisted.python.failure import Failure
 from twisted.python.filepath import FilePath
 from twisted.python.log import msg
 from twisted.python.reflect import requireModule
-from twisted.test.proto_helpers import EventLoggingObserver, MemoryReactorClock
 from twisted.trial.unittest import TestCase
 
 if requireModule("cryptography") and requireModule("pyasn1.type"):
@@ -77,7 +81,6 @@
     ConchUser = object  # type: ignore[assignment,misc]
 
 from twisted.test.iosim import FakeTransport, connect
-from twisted.test.proto_helpers import StringTransport
 
 
 class AbortableFakeTransport(FakeTransport):
diff --git a/src/twisted/conch/test/test_filetransfer.py b/src/twisted/conch/test/test_filetransfer.py
--- a/src/twisted/conch/test/test_filetransfer.py
+++ b/src/twisted/conch/test/test_filetransfer.py
@@ -16,11 +16,11 @@
 
 from twisted.internet import defer
 from twisted.internet.error import ConnectionLost
+from twisted.internet.testing import StringTransport
 from twisted.protocols import loopback
 from twisted.python import components
 from twisted.python.compat import _PY37PLUS
 from twisted.python.filepath import FilePath
-from twisted.test.proto_helpers import StringTransport
 from twisted.trial.unittest import TestCase
 
 try:
diff --git a/src/twisted/conch/test/test_forwarding.py b/src/twisted/conch/test/test_forwarding.py
--- a/src/twisted/conch/test/test_forwarding.py
+++ b/src/twisted/conch/test/test_forwarding.py
@@ -14,7 +14,7 @@
 
 from twisted.internet.address import IPv6Address
 from twisted.internet.test.test_endpoints import deterministicResolvingReactor
-from twisted.test.proto_helpers import MemoryReactorClock, StringTransport
+from twisted.internet.testing import MemoryReactorClock, StringTransport
 from twisted.trial import unittest
 
 
diff --git a/src/twisted/conch/test/test_insults.py b/src/twisted/conch/test/test_insults.py
--- a/src/twisted/conch/test/test_insults.py
+++ b/src/twisted/conch/test/test_insults.py
@@ -21,9 +21,9 @@
     privateModes,
 )
 from twisted.internet.protocol import Protocol
+from twisted.internet.testing import StringTransport
 from twisted.python.compat import iterbytes
 from twisted.python.constants import ValueConstant, Values
-from twisted.test.proto_helpers import StringTransport
 from twisted.trial import unittest
 
 
diff --git a/src/twisted/conch/test/test_manhole.py b/src/twisted/conch/test/test_manhole.py
--- a/src/twisted/conch/test/test_manhole.py
+++ b/src/twisted/conch/test/test_manhole.py
@@ -24,7 +24,7 @@
     stdio,
 )
 from twisted.internet import defer, error
-from twisted.test.proto_helpers import StringTransport
+from twisted.internet.testing import StringTransport
 from twisted.trial import unittest
 
 
diff --git a/src/twisted/conch/test/test_mixin.py b/src/twisted/conch/test/test_mixin.py
--- a/src/twisted/conch/test/test_mixin.py
+++ b/src/twisted/conch/test/test_mixin.py
@@ -3,7 +3,7 @@
 # See LICENSE for details.
 
 from twisted.conch import mixin
-from twisted.test.proto_helpers import StringTransport
+from twisted.internet.testing import StringTransport
 from twisted.trial import unittest
 
 
diff --git a/src/twisted/conch/test/test_recvline.py b/src/twisted/conch/test/test_recvline.py
--- a/src/twisted/conch/test/test_recvline.py
+++ b/src/twisted/conch/test/test_recvline.py
@@ -15,10 +15,10 @@
 from twisted.conch.insults import insults
 from twisted.cred import portal
 from twisted.internet import defer, error
+from twisted.internet.testing import StringTransport
 from twisted.python import components, filepath, reflect
 from twisted.python.compat import iterbytes
 from twisted.python.reflect import requireModule
-from twisted.test.proto_helpers import StringTransport
 from twisted.trial.unittest import SkipTest, TestCase
 
 stdio = requireModule("twisted.conch.stdio")
diff --git a/src/twisted/internet/test/test_protocol.py b/src/twisted/internet/test/test_protocol.py
--- a/src/twisted/internet/test/test_protocol.py
+++ b/src/twisted/internet/test/test_protocol.py
@@ -26,9 +26,9 @@
     Protocol,
     ProtocolToConsumerAdapter,
 )
+from twisted.internet.testing import MemoryReactorClock, StringTransport
 from twisted.logger import LogLevel, globalLogPublisher
 from twisted.python.failure import Failure
-from twisted.test.proto_helpers import MemoryReactorClock, StringTransport
 from twisted.trial.unittest import TestCase
 
 
diff --git a/src/twisted/internet/test/test_tcp.py b/src/twisted/internet/test/test_tcp.py
--- a/src/twisted/internet/test/test_tcp.py
+++ b/src/twisted/internet/test/test_tcp.py
@@ -81,11 +81,11 @@
     needsRunningReactor,
     stopOnError,
 )
+from twisted.internet.testing import MemoryReactor, StringTransport
 from twisted.logger import Logger
 from twisted.python import log
 from twisted.python.failure import Failure
 from twisted.python.runtime import platform
-from twisted.test.proto_helpers import MemoryReactor, StringTransport
 from twisted.test.test_tcp import (
     ClientStartStopFactory,
     ClosingFactory,
diff --git a/src/twisted/mail/test/test_imap.py b/src/twisted/mail/test/test_imap.py
--- a/src/twisted/mail/test/test_imap.py
+++ b/src/twisted/mail/test/test_imap.py
@@ -33,6 +33,7 @@
 from twisted.internet import defer, error, interfaces, reactor
 from twisted.internet.defer import Deferred
 from twisted.internet.task import Clock
+from twisted.internet.testing import StringTransport, StringTransportWithDisconnection
 from twisted.mail import imap4
 from twisted.mail.imap4 import MessageSet
 from twisted.mail.interfaces import (
@@ -43,7 +44,6 @@
 from twisted.protocols import loopback
 from twisted.python import failure, log, util
 from twisted.python.compat import iterbytes, nativeString, networkString
-from twisted.test.proto_helpers import StringTransport, StringTransportWithDisconnection
 from twisted.trial.unittest import SynchronousTestCase, TestCase
 
 try:
diff --git a/src/twisted/mail/test/test_mail.py b/src/twisted/mail/test/test_mail.py
--- a/src/twisted/mail/test/test_mail.py
+++ b/src/twisted/mail/test/test_mail.py
@@ -42,6 +42,11 @@
     ProcessDone,
     ProcessTerminated,
 )
+from twisted.internet.testing import (
+    LineSendingProtocol,
+    MemoryReactorClock,
+    StringTransport,
+)
 from twisted.mail import pop3, smtp
 from twisted.mail.relaymanager import _AttemptManager
 from twisted.names import dns
@@ -50,11 +55,6 @@
 from twisted.python import failure, log
 from twisted.python.filepath import FilePath
 from twisted.python.runtime import platformType
-from twisted.test.proto_helpers import (
-    LineSendingProtocol,
-    MemoryReactorClock,
-    StringTransport,
-)
 from twisted.trial.unittest import TestCase
 
 
diff --git a/src/twisted/mail/test/test_mailmail.py b/src/twisted/mail/test/test_mailmail.py
--- a/src/twisted/mail/test/test_mailmail.py
+++ b/src/twisted/mail/test/test_mailmail.py
@@ -14,12 +14,12 @@
 
 from twisted.copyright import version
 from twisted.internet.defer import Deferred
+from twisted.internet.testing import MemoryReactor
 from twisted.mail import smtp
 from twisted.mail.scripts import mailmail
 from twisted.mail.scripts.mailmail import parseOptions
 from twisted.python.failure import Failure
 from twisted.python.runtime import platformType
-from twisted.test.proto_helpers import MemoryReactor
 from twisted.trial.unittest import TestCase
 
 
diff --git a/src/twisted/mail/test/test_pop3.py b/src/twisted/mail/test/test_pop3.py
--- a/src/twisted/mail/test/test_pop3.py
+++ b/src/twisted/mail/test/test_pop3.py
@@ -24,10 +24,10 @@
 from twisted import cred, internet, mail
 from twisted.cred.credentials import IUsernameHashedPassword
 from twisted.internet import defer
+from twisted.internet.testing import LineSendingProtocol
 from twisted.mail import pop3
 from twisted.protocols import loopback
 from twisted.python import failure
-from twisted.test.proto_helpers import LineSendingProtocol
 from twisted.trial import unittest, util
 
 
diff --git a/src/twisted/mail/test/test_pop3client.py b/src/twisted/mail/test/test_pop3client.py
--- a/src/twisted/mail/test/test_pop3client.py
+++ b/src/twisted/mail/test/test_pop3client.py
@@ -11,6 +11,7 @@
 
 import twisted.mail._pop3client
 from twisted.internet import defer, error, interfaces, protocol, reactor
+from twisted.internet.testing import StringTransport
 from twisted.mail.pop3 import (
     AdvancedPOP3Client as POP3Client,
     InsecureAuthenticationDisallowed,
@@ -19,7 +20,6 @@
 from twisted.mail.test import pop3testserver
 from twisted.protocols import basic, loopback
 from twisted.python import log
-from twisted.test.proto_helpers import StringTransport
 from twisted.trial.unittest import TestCase
 
 try:
diff --git a/src/twisted/mail/test/test_smtp.py b/src/twisted/mail/test/test_smtp.py
--- a/src/twisted/mail/test/test_smtp.py
+++ b/src/twisted/mail/test/test_smtp.py
@@ -24,11 +24,11 @@
 from twisted.cred.error import UnauthorizedLogin
 from twisted.cred.portal import IRealm, Portal
 from twisted.internet import address, defer, error, interfaces, protocol, reactor, task
+from twisted.internet.testing import MemoryReactor, StringTransport
 from twisted.mail import smtp
 from twisted.mail._cred import LOGINCredentials
 from twisted.protocols import basic, loopback
 from twisted.python.util import LineLog
-from twisted.test.proto_helpers import MemoryReactor, StringTransport
 from twisted.trial.unittest import TestCase
 
 sslSkip: Optional[str]
diff --git a/src/twisted/names/test/test_names.py b/src/twisted/names/test/test_names.py
--- a/src/twisted/names/test/test_names.py
+++ b/src/twisted/names/test/test_names.py
@@ -15,6 +15,11 @@
 
 from twisted.internet import defer, error, reactor
 from twisted.internet.defer import succeed
+from twisted.internet.testing import (
+    MemoryReactorClock,
+    StringTransport,
+    waitUntilAllDisconnected,
+)
 from twisted.names import authority, client, common, dns, server
 from twisted.names.client import Resolver
 from twisted.names.dns import SOA, Message, Query, Record_A, Record_SOA, RRHeader
@@ -22,11 +27,6 @@
 from twisted.names.secondary import SecondaryAuthority, SecondaryAuthorityService
 from twisted.python.compat import nativeString
 from twisted.python.filepath import FilePath
-from twisted.test.proto_helpers import (
-    MemoryReactorClock,
-    StringTransport,
-    waitUntilAllDisconnected,
-)
 from twisted.trial import unittest
 
 
diff --git a/src/twisted/names/test/test_srvconnect.py b/src/twisted/names/test/test_srvconnect.py
--- a/src/twisted/names/test/test_srvconnect.py
+++ b/src/twisted/names/test/test_srvconnect.py
@@ -13,10 +13,10 @@
 from twisted.internet import defer, protocol
 from twisted.internet.error import DNSLookupError, ServiceNameUnknownError
 from twisted.internet.interfaces import IConnector
+from twisted.internet.testing import MemoryReactor
 from twisted.names import client, dns, srvconnect
 from twisted.names.common import ResolverBase
 from twisted.names.error import DNSNameError
-from twisted.test.proto_helpers import MemoryReactor
 from twisted.trial import unittest
 
 
diff --git a/src/twisted/protocols/haproxy/test/test_parser.py b/src/twisted/protocols/haproxy/test/test_parser.py
--- a/src/twisted/protocols/haproxy/test/test_parser.py
+++ b/src/twisted/protocols/haproxy/test/test_parser.py
@@ -14,7 +14,7 @@
     _WrapperServerEndpoint,
     serverFromString,
 )
-from twisted.test.proto_helpers import MemoryReactor
+from twisted.internet.testing import MemoryReactor
 from twisted.trial.unittest import SynchronousTestCase as TestCase
 from .._parser import unparseEndpoint
 from .._wrapper import HAProxyWrappingFactory
diff --git a/src/twisted/protocols/haproxy/test/test_wrapper.py b/src/twisted/protocols/haproxy/test/test_wrapper.py
--- a/src/twisted/protocols/haproxy/test/test_wrapper.py
+++ b/src/twisted/protocols/haproxy/test/test_wrapper.py
@@ -9,7 +9,7 @@
 
 from twisted.internet import address
 from twisted.internet.protocol import Factory, Protocol
-from twisted.test.proto_helpers import StringTransportWithDisconnection
+from twisted.internet.testing import StringTransportWithDisconnection
 from twisted.trial import unittest
 from .._wrapper import HAProxyWrappingFactory
 
diff --git a/src/twisted/protocols/test/test_tls.py b/src/twisted/protocols/test/test_tls.py
--- a/src/twisted/protocols/test/test_tls.py
+++ b/src/twisted/protocols/test/test_tls.py
@@ -55,12 +55,12 @@
 )
 from twisted.internet.protocol import ClientFactory, Factory, Protocol, ServerFactory
 from twisted.internet.task import TaskStopped
+from twisted.internet.testing import NonStreamingProducer, StringTransport
 from twisted.protocols.loopback import collapsingPumpPolicy, loopbackAsync
 from twisted.python import log
 from twisted.python.failure import Failure
 from twisted.python.filepath import FilePath
 from twisted.test.iosim import connectedServerAndClient
-from twisted.test.proto_helpers import NonStreamingProducer, StringTransport
 from twisted.test.test_tcp import ConnectionLostNotifyingProtocol
 from twisted.trial.unittest import SynchronousTestCase, TestCase
 
diff --git a/src/twisted/runner/test/test_procmon.py b/src/twisted/runner/test/test_procmon.py
--- a/src/twisted/runner/test/test_procmon.py
+++ b/src/twisted/runner/test/test_procmon.py
@@ -8,10 +8,10 @@
 
 from twisted.internet.error import ProcessDone, ProcessExitedAlready, ProcessTerminated
 from twisted.internet.task import Clock
+from twisted.internet.testing import MemoryReactor
 from twisted.logger import globalLogPublisher
 from twisted.python.failure import Failure
 from twisted.runner.procmon import LoggingProtocol, ProcessMonitor
-from twisted.test.proto_helpers import MemoryReactor
 from twisted.trial import unittest
 
 
diff --git a/src/twisted/spread/test/test_banana.py b/src/twisted/spread/test/test_banana.py
--- a/src/twisted/spread/test/test_banana.py
+++ b/src/twisted/spread/test/test_banana.py
@@ -7,10 +7,10 @@
 from io import BytesIO
 
 from twisted.internet import main, protocol
+from twisted.internet.testing import StringTransport
 from twisted.python import failure
 from twisted.python.compat import iterbytes
 from twisted.spread import banana
-from twisted.test.proto_helpers import StringTransport
 from twisted.trial.unittest import TestCase
 
 _maxint = 9223372036854775807
diff --git a/src/twisted/spread/test/test_jelly.py b/src/twisted/spread/test/test_jelly.py
--- a/src/twisted/spread/test/test_jelly.py
+++ b/src/twisted/spread/test/test_jelly.py
@@ -9,8 +9,8 @@
 import datetime
 import decimal
 
+from twisted.internet.testing import StringTransport
 from twisted.spread import banana, jelly, pb
-from twisted.test.proto_helpers import StringTransport
 from twisted.trial import unittest
 from twisted.trial.unittest import TestCase
 
diff --git a/src/twisted/spread/test/test_pb.py b/src/twisted/spread/test/test_pb.py
--- a/src/twisted/spread/test/test_pb.py
+++ b/src/twisted/spread/test/test_pb.py
@@ -28,11 +28,11 @@
 from twisted.internet import address, main, protocol, reactor
 from twisted.internet.defer import Deferred, gatherResults, succeed
 from twisted.internet.error import ConnectionRefusedError
+from twisted.internet.testing import _FakeConnector
 from twisted.protocols.policies import WrappingFactory
 from twisted.python import failure, log
 from twisted.python.compat import iterbytes
 from twisted.spread import jelly, pb, publish, util
-from twisted.test.proto_helpers import _FakeConnector
 from twisted.trial import unittest
 
 
diff --git a/src/twisted/test/test_amp.py b/src/twisted/test/test_amp.py
--- a/src/twisted/test/test_amp.py
+++ b/src/twisted/test/test_amp.py
@@ -16,11 +16,11 @@
 from zope.interface.verify import verifyClass, verifyObject
 
 from twisted.internet import address, defer, error, interfaces, protocol, reactor
+from twisted.internet.testing import StringTransport
 from twisted.protocols import amp
 from twisted.python import filepath
 from twisted.python.failure import Failure
 from twisted.test import iosim
-from twisted.test.proto_helpers import StringTransport
 from twisted.trial.unittest import TestCase
 
 try:
diff --git a/src/twisted/test/test_application.py b/src/twisted/test/test_application.py
--- a/src/twisted/test/test_application.py
+++ b/src/twisted/test/test_application.py
@@ -22,13 +22,13 @@
 from twisted.application import app, internet, reactors, service
 from twisted.application.internet import backoffPolicy
 from twisted.internet import defer, interfaces, protocol, reactor
+from twisted.internet.testing import MemoryReactor
 from twisted.persisted import sob
 from twisted.plugins import twisted_reactors
 from twisted.protocols import basic, wire
 from twisted.python import usage
 from twisted.python.runtime import platformType
 from twisted.python.test.modules_helpers import TwistedModulesMixin
-from twisted.test.proto_helpers import MemoryReactor
 from twisted.trial.unittest import SkipTest, TestCase
 
 
diff --git a/src/twisted/test/test_finger.py b/src/twisted/test/test_finger.py
--- a/src/twisted/test/test_finger.py
+++ b/src/twisted/test/test_finger.py
@@ -5,8 +5,8 @@
 Tests for L{twisted.protocols.finger}.
 """
 
+from twisted.internet.testing import StringTransport
 from twisted.protocols import finger
-from twisted.test.proto_helpers import StringTransport
 from twisted.trial import unittest
 
 
diff --git a/src/twisted/test/test_ident.py b/src/twisted/test/test_ident.py
--- a/src/twisted/test/test_ident.py
+++ b/src/twisted/test/test_ident.py
@@ -11,9 +11,9 @@
 from io import StringIO
 
 from twisted.internet import defer, error
+from twisted.internet.testing import StringTransport
 from twisted.protocols import ident
 from twisted.python import failure
-from twisted.test.proto_helpers import StringTransport
 from twisted.trial import unittest
 
 
diff --git a/src/twisted/test/test_memcache.py b/src/twisted/test/test_memcache.py
--- a/src/twisted/test/test_memcache.py
+++ b/src/twisted/test/test_memcache.py
@@ -9,13 +9,13 @@
 from twisted.internet.defer import Deferred, DeferredList, TimeoutError, gatherResults
 from twisted.internet.error import ConnectionDone
 from twisted.internet.task import Clock
+from twisted.internet.testing import StringTransportWithDisconnection
 from twisted.protocols.memcache import (
     ClientError,
     MemCacheProtocol,
     NoSuchCommand,
     ServerError,
 )
-from twisted.test.proto_helpers import StringTransportWithDisconnection
 from twisted.trial.unittest import TestCase
 
 
diff --git a/src/twisted/test/test_policies.py b/src/twisted/test/test_policies.py
--- a/src/twisted/test/test_policies.py
+++ b/src/twisted/test/test_policies.py
@@ -12,8 +12,8 @@
 from zope.interface import Interface, implementedBy, implementer
 
 from twisted.internet import address, defer, protocol, reactor, task
+from twisted.internet.testing import StringTransport, StringTransportWithDisconnection
 from twisted.protocols import policies
-from twisted.test.proto_helpers import StringTransport, StringTransportWithDisconnection
 from twisted.trial import unittest
 
 
diff --git a/src/twisted/test/test_postfix.py b/src/twisted/test/test_postfix.py
--- a/src/twisted/test/test_postfix.py
+++ b/src/twisted/test/test_postfix.py
@@ -7,8 +7,8 @@
 
 from typing import Dict, List, Tuple
 
+from twisted.internet.testing import StringTransport
 from twisted.protocols import postfix
-from twisted.test.proto_helpers import StringTransport
 from twisted.trial import unittest
 
 
diff --git a/src/twisted/test/test_ssl.py b/src/twisted/test/test_ssl.py
--- a/src/twisted/test/test_ssl.py
+++ b/src/twisted/test/test_ssl.py
@@ -11,10 +11,10 @@
 
 from twisted.internet import defer, interfaces, protocol, reactor
 from twisted.internet.error import ConnectionDone
+from twisted.internet.testing import waitUntilAllDisconnected
 from twisted.protocols import basic
 from twisted.python.filepath import FilePath
 from twisted.python.runtime import platform
-from twisted.test.proto_helpers import waitUntilAllDisconnected
 from twisted.test.test_tcp import ProperlyCloseFilesMixin
 from twisted.trial.unittest import TestCase
 
diff --git a/src/twisted/test/test_tcp.py b/src/twisted/test/test_tcp.py
--- a/src/twisted/test/test_tcp.py
+++ b/src/twisted/test/test_tcp.py
@@ -21,10 +21,10 @@
 from twisted.internet.address import IPv4Address
 from twisted.internet.interfaces import IHalfCloseableProtocol, IPullProducer
 from twisted.internet.protocol import Protocol
+from twisted.internet.testing import AccumulatingProtocol
 from twisted.protocols import policies
 from twisted.python.log import err, msg
 from twisted.python.runtime import platform
-from twisted.test.proto_helpers import AccumulatingProtocol
 from twisted.trial.unittest import SkipTest, TestCase
 
 
diff --git a/src/twisted/test/test_twistd.py b/src/twisted/test/test_twistd.py
--- a/src/twisted/test/test_twistd.py
+++ b/src/twisted/test/test_twistd.py
@@ -36,6 +36,7 @@
 from twisted.internet.defer import Deferred
 from twisted.internet.interfaces import IReactorDaemonize, _ISupportsExitSignalCapturing
 from twisted.internet.test.modulehelpers import AlternateReactor
+from twisted.internet.testing import MemoryReactor
 from twisted.logger import ILogObserver, globalLogBeginner, globalLogPublisher
 from twisted.python import util
 from twisted.python.components import Componentized
@@ -45,7 +46,6 @@
 from twisted.python.runtime import platformType
 from twisted.python.usage import UsageError
 from twisted.scripts import twistd
-from twisted.test.proto_helpers import MemoryReactor
 from twisted.test.test_process import MockOS
 from twisted.trial.unittest import TestCase
 
diff --git a/src/twisted/trial/_dist/test/test_disttrial.py b/src/twisted/trial/_dist/test/test_disttrial.py
--- a/src/twisted/trial/_dist/test/test_disttrial.py
+++ b/src/twisted/trial/_dist/test/test_disttrial.py
@@ -35,10 +35,10 @@
 from twisted.internet.error import ProcessDone
 from twisted.internet.protocol import ProcessProtocol, Protocol
 from twisted.internet.test.modulehelpers import AlternateReactor
+from twisted.internet.testing import MemoryReactorClock
 from twisted.python.failure import Failure
 from twisted.python.filepath import FilePath
 from twisted.python.lockfile import FilesystemLock
-from twisted.test.proto_helpers import MemoryReactorClock
 from twisted.trial._dist import _WORKER_AMP_STDIN
 from twisted.trial._dist.distreporter import DistReporter
 from twisted.trial._dist.disttrial import DistTrialRunner, WorkerPool, WorkerPoolConfig
diff --git a/src/twisted/trial/_dist/test/test_workertrial.py b/src/twisted/trial/_dist/test/test_workertrial.py
--- a/src/twisted/trial/_dist/test/test_workertrial.py
+++ b/src/twisted/trial/_dist/test/test_workertrial.py
@@ -9,8 +9,8 @@
 import sys
 from io import BytesIO
 
+from twisted.internet.testing import StringTransport
 from twisted.protocols.amp import AMP
-from twisted.test.proto_helpers import StringTransport
 from twisted.trial._dist import (
     _WORKER_AMP_STDIN,
     _WORKER_AMP_STDOUT,
diff --git a/src/twisted/web/test/test_agent.py b/src/twisted/web/test/test_agent.py
--- a/src/twisted/web/test/test_agent.py
+++ b/src/twisted/web/test/test_agent.py
@@ -29,17 +29,17 @@
 from twisted.internet.protocol import Factory, Protocol
 from twisted.internet.task import Clock
 from twisted.internet.test.test_endpoints import deterministicResolvingReactor
-from twisted.logger import globalLogPublisher
-from twisted.python.components import proxyForInterface
-from twisted.python.deprecate import getDeprecationWarningString
-from twisted.python.failure import Failure
-from twisted.test.iosim import FakeTransport, IOPump
-from twisted.test.proto_helpers import (
+from twisted.internet.testing import (
     AccumulatingProtocol,
     EventLoggingObserver,
     MemoryReactorClock,
     StringTransport,
 )
+from twisted.logger import globalLogPublisher
+from twisted.python.components import proxyForInterface
+from twisted.python.deprecate import getDeprecationWarningString
+from twisted.python.failure import Failure
+from twisted.test.iosim import FakeTransport, IOPump
 from twisted.test.test_sslverify import certificatesForAuthorityAndServer
 from twisted.trial.unittest import SynchronousTestCase, TestCase
 from twisted.web import client, error, http_headers
diff --git a/src/twisted/web/test/test_http.py b/src/twisted/web/test/test_http.py
--- a/src/twisted/web/test/test_http.py
+++ b/src/twisted/web/test/test_http.py
@@ -24,16 +24,16 @@
 from twisted.internet import address
 from twisted.internet.error import ConnectionDone, ConnectionLost
 from twisted.internet.task import Clock
+from twisted.internet.testing import (
+    EventLoggingObserver,
+    NonStreamingProducer,
+    StringTransport,
+)
 from twisted.logger import globalLogPublisher
 from twisted.protocols import loopback
 from twisted.python.compat import iterbytes, networkString
 from twisted.python.components import proxyForInterface
 from twisted.python.failure import Failure
-from twisted.test.proto_helpers import (
-    EventLoggingObserver,
-    NonStreamingProducer,
-    StringTransport,
-)
 from twisted.test.test_internet import DummyProducer
 from twisted.trial import unittest
 from twisted.trial.unittest import TestCase
diff --git a/src/twisted/web/test/test_httpauth.py b/src/twisted/web/test/test_httpauth.py
--- a/src/twisted/web/test/test_httpauth.py
+++ b/src/twisted/web/test/test_httpauth.py
@@ -20,9 +20,9 @@
 from twisted.cred.credentials import IUsernamePassword
 from twisted.internet.address import IPv4Address
 from twisted.internet.error import ConnectionDone
+from twisted.internet.testing import EventLoggingObserver
 from twisted.logger import globalLogPublisher
 from twisted.python.failure import Failure
-from twisted.test.proto_helpers import EventLoggingObserver
 from twisted.trial import unittest
 from twisted.web._auth import basic, digest
 from twisted.web._auth.basic import BasicCredentialFactory
diff --git a/src/twisted/web/test/test_newclient.py b/src/twisted/web/test/test_newclient.py
--- a/src/twisted/web/test/test_newclient.py
+++ b/src/twisted/web/test/test_newclient.py
@@ -14,15 +14,15 @@
 from twisted.internet.error import ConnectionDone, ConnectionLost
 from twisted.internet.interfaces import IConsumer, IPushProducer
 from twisted.internet.protocol import Protocol
-from twisted.logger import globalLogPublisher
-from twisted.protocols.basic import LineReceiver
-from twisted.python.failure import Failure
-from twisted.test.proto_helpers import (
+from twisted.internet.testing import (
     AccumulatingProtocol,
     EventLoggingObserver,
     StringTransport,
     StringTransportWithDisconnection,
 )
+from twisted.logger import globalLogPublisher
+from twisted.protocols.basic import LineReceiver
+from twisted.python.failure import Failure
 from twisted.trial.unittest import TestCase
 from twisted.web._newclient import (
     BODY,
diff --git a/src/twisted/web/test/test_proxy.py b/src/twisted/web/test/test_proxy.py
--- a/src/twisted/web/test/test_proxy.py
+++ b/src/twisted/web/test/test_proxy.py
@@ -5,7 +5,7 @@
 Test for L{twisted.web.proxy}.
 """
 
-from twisted.test.proto_helpers import MemoryReactor, StringTransportWithDisconnection
+from twisted.internet.testing import MemoryReactor, StringTransportWithDisconnection
 from twisted.trial.unittest import TestCase
 from twisted.web.proxy import (
     ProxyClient,
diff --git a/src/twisted/web/test/test_template.py b/src/twisted/web/test/test_template.py
--- a/src/twisted/web/test/test_template.py
+++ b/src/twisted/web/test/test_template.py
@@ -13,10 +13,10 @@
 from zope.interface.verify import verifyObject
 
 from twisted.internet.defer import Deferred, succeed
+from twisted.internet.testing import EventLoggingObserver
 from twisted.logger import globalLogPublisher
 from twisted.python.failure import Failure
 from twisted.python.filepath import FilePath
-from twisted.test.proto_helpers import EventLoggingObserver
 from twisted.trial.unittest import TestCase
 from twisted.trial.util import suppress as SUPPRESS
 from twisted.web._element import UnexposedMethodError
diff --git a/src/twisted/web/test/test_web.py b/src/twisted/web/test/test_web.py
--- a/src/twisted/web/test/test_web.py
+++ b/src/twisted/web/test/test_web.py
@@ -15,10 +15,10 @@
 from twisted.internet import interfaces
 from twisted.internet.address import IPv4Address, IPv6Address
 from twisted.internet.task import Clock
+from twisted.internet.testing import EventLoggingObserver
 from twisted.logger import LogLevel, globalLogPublisher
 from twisted.python import failure, reflect
 from twisted.python.filepath import FilePath
-from twisted.test.proto_helpers import EventLoggingObserver
 from twisted.trial import unittest
 from twisted.web import error, http, iweb, resource, server
 from twisted.web.static import Data
diff --git a/src/twisted/web/test/test_wsgi.py b/src/twisted/web/test/test_wsgi.py
--- a/src/twisted/web/test/test_wsgi.py
+++ b/src/twisted/web/test/test_wsgi.py
@@ -17,11 +17,11 @@
 from twisted.internet.address import IPv4Address, IPv6Address
 from twisted.internet.defer import Deferred, gatherResults
 from twisted.internet.error import ConnectionLost
+from twisted.internet.testing import EventLoggingObserver
 from twisted.logger import Logger, globalLogPublisher
 from twisted.python.failure import Failure
 from twisted.python.threadable import getThreadID
 from twisted.python.threadpool import ThreadPool
-from twisted.test.proto_helpers import EventLoggingObserver
 from twisted.trial.unittest import TestCase
 from twisted.web import http
 from twisted.web.resource import IResource, Resource
diff --git a/src/twisted/web/test/test_xmlrpc.py b/src/twisted/web/test/test_xmlrpc.py
--- a/src/twisted/web/test/test_xmlrpc.py
+++ b/src/twisted/web/test/test_xmlrpc.py
@@ -13,6 +13,7 @@
 
 from twisted.internet import defer, reactor
 from twisted.internet.error import ConnectionDone
+from twisted.internet.testing import EventLoggingObserver, MemoryReactor
 from twisted.logger import (
     FilteringLogObserver,
     LogLevel,
@@ -22,7 +23,6 @@
 from twisted.python import failure
 from twisted.python.compat import nativeString, networkString
 from twisted.python.reflect import namedModule
-from twisted.test.proto_helpers import EventLoggingObserver, MemoryReactor
 from twisted.trial import unittest
 from twisted.web import client, http, server, static, xmlrpc
 from twisted.web.test.test_web import DummyRequest
diff --git a/src/twisted/words/test/test_irc.py b/src/twisted/words/test/test_irc.py
--- a/src/twisted/words/test/test_irc.py
+++ b/src/twisted/words/test/test_irc.py
@@ -10,8 +10,8 @@
 import time
 
 from twisted.internet import protocol, task
+from twisted.internet.testing import StringIOWithoutClosing, StringTransport
 from twisted.python.filepath import FilePath
-from twisted.test.proto_helpers import StringIOWithoutClosing, StringTransport
 from twisted.trial.unittest import TestCase
 from twisted.words.protocols import irc
 from twisted.words.protocols.irc import IRCClient, attributes as A
diff --git a/src/twisted/words/test/test_ircsupport.py b/src/twisted/words/test/test_ircsupport.py
--- a/src/twisted/words/test/test_ircsupport.py
+++ b/src/twisted/words/test/test_ircsupport.py
@@ -5,7 +5,7 @@
 Tests for L{twisted.words.im.ircsupport}.
 """
 
-from twisted.test.proto_helpers import StringTransport
+from twisted.internet.testing import StringTransport
 from twisted.words.im.basechat import ChatUI, Conversation, GroupConversation
 from twisted.words.im.ircsupport import IRCAccount, IRCProto
 from twisted.words.im.locals import OfflineError