From 5717c09e4fed6190c3f9bae4dbeb44d4b60bad3d Mon Sep 17 00:00:00 2001 From: Jonathan Lange Date: Sat, 9 Jan 2016 12:33:05 +0000 Subject: [PATCH] Nicer links --- doc/twisted-support.rst | 22 ++++++++++++---------- testtools/_deferredmatchers.py | 14 +++++++------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/doc/twisted-support.rst b/doc/twisted-support.rst index abd9b30..66ddbe6 100644 --- a/doc/twisted-support.rst +++ b/doc/twisted-support.rst @@ -5,18 +5,20 @@ Matching Deferreds ------------------ testtools provides support for making assertions about synchronous -:py:class:`twisted.internet.defer.Deferred`\s. +:py:class:`~twisted.internet.defer.Deferred`\s. -A "synchronous" :py:class:`.Deferred` is one that does not need the reactor or -any other asynchronous process in order to fire. +A "synchronous" :py:class:`~twisted.internet.defer.Deferred` is one that does +not need the reactor or any other asynchronous process in order to fire. -Normal application code can't know when a :py:class:`.Deferred` is going to -fire, because that is generally left up to the reactor. Well-written unit -tests provide fake reactors, or don't use the reactor at all, so that -:py:class:`.Deferred`\s fire synchronously. +Normal application code can't know when a +:py:class:`~twisted.internet.defer.Deferred` is going to fire, because that is +generally left up to the reactor. Well-written unit tests provide fake +reactors, or don't use the reactor at all, so that +:py:class:`~twisted.internet.defer.Deferred`\s fire synchronously. These matchers allow you to make assertions about when and how -:py:class:`.Deferred`\s fire, and about what values they fire with. +:py:class:`~twisted.internet.defer.Deferred`\s fire, and about what values +they fire with. See also `Testing Deferreds without the reactor`_ and the `Deferred howto`_. @@ -32,8 +34,8 @@ Running tests in the reactor ---------------------------- testtools provides support for running asynchronous Twisted tests: tests that -return a :py:class:`.Deferred` and run the reactor until it fires and its -callback chain is completed. +return a :py:class:`~twisted.internet.defer.Deferred` and run the reactor +until it fires and its callback chain is completed. Here's how to use it:: diff --git a/testtools/_deferredmatchers.py b/testtools/_deferredmatchers.py index c429047..ee5d1e2 100644 --- a/testtools/_deferredmatchers.py +++ b/testtools/_deferredmatchers.py @@ -192,8 +192,10 @@ def successful(matcher): Use this instead of :py:meth:`twisted.trial.unittest.SynchronousTestCase.successResultOf`. - :param matcher: A matcher to match against the result of a Deferred. - :return: A matcher that can be applied to a synchronous Deferred. + :param matcher: A matcher to match against the result of a + :class:`~twisted.internet.defer.Deferred`. + :return: A matcher that can be applied to a synchronous + :class:`~twisted.internet.defer.Deferred`. """ return _Successful(matcher) @@ -252,8 +254,9 @@ def failed(matcher): :py:meth:`twisted.trial.unittest.SynchronousTestCase.failureResultOf`. :param matcher: A matcher to match against the result of a failing - Deferred. - :return: A matcher that can be applied to a synchronous Deferred. + :class:`~twisted.internet.defer.Deferred`. + :return: A matcher that can be applied to a synchronous + :class:`~twisted.internet.defer.Deferred`. """ return _Failed(matcher) @@ -261,8 +264,5 @@ def failed(matcher): # TODO: Move the non-matcher stuff to _deferred. -# TODO: Figure out how to just say "Deferred" and get sphinx to link to -# Deferred (i.e. to not have to give fully qualified Python name each time). - # TODO: Fix configuration so that Twisted is included as dependency when we # build on rtfd.