Twisted protocol testing

I have very simple client and server protocols developed with Twisted

. Twisted allows unittest to do it on its own and provides useful testing utilities for this, such as StringTransport

.

However, let's say I want to check the protocol is working fine. For example, I want to check that when the server receives a certain message, it will respond to the client in a certain way. What's the best way to do this with trial

and utils in Twisted? I am currently running processes to start them, but then I lose access to their objects and I need to reset their states in a file in order to verify that the behavior is correct. I don't think this is a clean way to do it. It would be much better to use StringTransport

one that simulates a TCP connection from client to server. How do twisted devs usually test this?

+2
python twisted unit-testing testing


source to share


No one has answered this question yet

See similar questions:

3
How do I check for LoopingCall ()?

or similar:

2560
How can I test a private function or class with private methods, fields or inner classes?
830
Unit Testing C Code
681
What is Unit test, integration test, Smoke test, regression test?
573
Is unit testing worth the effort?
507
Writing Unit Tests in Python: How Do I Get Started?
ten
Mix Python Twisted with multiprocessing?
3
Python Twisted: a separate protocol from processing
2
Using a bunny with a twisted
1
Twisted daemon unittest
1
Python Twisted: changing directories for each client independently



All Articles
Loading...
X
Show
Funny
Dev
Pics