title: How to perform Unit testing on PySpark Structured Streaming?
body: <p>I'm using PySpark Structured Streaming with Kafka as a reader stream. For the sake of unit testing, I would like to replace Kafka reader stream with a mock. How can I do this?</p>
  <p>The following question is equivalent to mine but I use Python (PySpark) instead of Scala. And I couldn't find MemoryStream in PySpark.</p>
  <p><a href="https://stackoverflow.com/questions/56894068/how-to-perform-unit-testing-on-spark-structured-streaming">How to perform Unit testing on Spark Structured Streaming?</a></p>