Github user zsxwing commented on the pull request:

    https://github.com/apache/spark/pull/4229#issuecomment-118898618
  
    @prabeesh
    
    To write a Python unit test, could you take a look at `KafkaStreamTests` 
and `FlumeStreamTests` in 
https://github.com/apache/spark/blob/master/python/pyspark/streaming/tests.py?
    Generally, you need to add something like 
[FlumeTestUtils](https://github.com/apache/spark/blob/master/external/flume/src/main/scala/org/apache/spark/streaming/flume/FlumeTestUtils.scala)
 or 
[KafkaTestUtils](https://github.com/apache/spark/blob/master/external/kafka/src/main/scala/org/apache/spark/streaming/kafka/KafkaTestUtils.scala)
 to add a method to setup a MQTT server in Scala. Then in the Python unit test, 
you can call this Scala method via py4j, and then use the Python MQTT api to 
setup a stream, and verify it. You can reuse many codes in 
[MQTTStreamSuite](https://github.com/apache/spark/blob/master/external/mqtt/src/test/scala/org/apache/spark/streaming/mqtt/MQTTStreamSuite.scala).
     


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to