test_python_paho_mqtt.py 734 B

1234567891011121314151617181920212223
  1. from tests.package.test_python import TestPythonPackageBase
  2. import os
  3. class TestPythonPahoMQTT(TestPythonPackageBase):
  4. __test__ = True
  5. config = TestPythonPackageBase.config + \
  6. """
  7. BR2_PACKAGE_MOSQUITTO=y
  8. BR2_PACKAGE_MOSQUITTO_BROKER=y
  9. BR2_PACKAGE_PYTHON3=y
  10. BR2_PACKAGE_PYTHON_PAHO_MQTT=y
  11. """
  12. sample_scripts = ["tests/package/sample_python_paho_mqtt.py"]
  13. def test_run(self):
  14. self.login()
  15. self.check_sample_scripts_exist()
  16. cmd = "%s %s" % (self.interpreter, os.path.basename(self.sample_scripts[0]))
  17. output, exit_code = self.emulator.run(cmd)
  18. self.assertEqual(exit_code, 0)
  19. self.assertEqual(output[0], "Hello, World!")