1

Think of a situation where a Python script sends commands to an external device,let's say, via serial port. The script resides on some Linux machine and the equipment reacts to some commands. The idea is to simulate all this chain on my machine by "sending" commands to a file which contains the dump that would be generated by the equipment, otherwise. It is first time when I'm trying such thing and it will be good to hear from someone who had experience with such situation. I red on the web and people are talking about few direction:

  • multiprocessing
  • RPyC
  • Threading
  • zmq

It might be more but not aware of. Any suggestions?

flamenco
  • 2,702
  • 5
  • 30
  • 46
  • To simulate a serial port just use a file since it's exactly the same as using a serial port (same write() and read() commands). –  May 23 '14 at 18:52
  • @ Andre: Serial port is just an example...it can be anything. I just put it in my question just to emphasis that the script will communicate with and external device. I should add this as part of my question – flamenco May 23 '14 at 19:14

1 Answers1

2

Assuming you actually test in real-world conditions (e.g. with the real device) but need to perform some tests on some particular conditions that are difficult to consistently reproduce in practice, you can simply mock the part of that communicates with the device to simulate those "edge" cases.

André Caron
  • 44,541
  • 12
  • 67
  • 125