[Twisted-Python] the right way of unit testing protocols
Itamar Shtull-Trauring
itamar at itamarst.org
Thu Jul 31 09:03:07 MDT 2003
On Thu, 31 Jul 2003 14:07:10 +0300
Tommi Virtanen <tv at twistedmatrix.com> wrote:
> Opening TCP sockets in unit tests is just not _unit_ testing
> in my book. Please don't do it in unit tests. It just makes it
> harder to run your unit tests in varying environments. (Who
> says I allow you to bind to port 1234? Who says it's free?
> Who says I allow you to listen *at all*?)
Most of Twisted's unittests listen on 0 and then figure out which port
was bound to.
> Also, you should not be testing just interoperability between
> *your* client and *your* server, but interoperability of your
> server with a "standard", and interoperability of your client
> with a "standard". For that, I prefer doing something like
> this:
Also a very good idea, but doing both is better than just one. The more
tests the better.
--
Itamar Shtull-Trauring http://itamarst.org/
http://www.zoteca.com -- Python & Twisted consulting
More information about the Twisted-Python
mailing list