test_python_twisted.py 978 B

123456789101112131415161718192021222324252627282930
  1. from tests.package.test_python import TestPythonPackageBase
  2. class TestPythonTwisted(TestPythonPackageBase):
  3. config = TestPythonPackageBase.config
  4. sample_scripts = ["tests/package/sample_python_twisted.py"]
  5. def run_sample_scripts(self):
  6. cmd = "netstat -ltn 2>/dev/null | grep 0.0.0.0:1234"
  7. _, exit_code = self.emulator.run(cmd)
  8. self.assertEqual(exit_code, 1)
  9. cmd = self.interpreter + " sample_python_twisted.py &"
  10. # give some time to setup the server
  11. cmd += "sleep 30"
  12. _, exit_code = self.emulator.run(cmd, timeout=35)
  13. self.assertEqual(exit_code, 0)
  14. cmd = "netstat -ltn 2>/dev/null | grep 0.0.0.0:1234"
  15. _, exit_code = self.emulator.run(cmd)
  16. self.assertEqual(exit_code, 0)
  17. class TestPythonPy3Twisted(TestPythonTwisted):
  18. __test__ = True
  19. config = TestPythonTwisted.config + \
  20. """
  21. BR2_PACKAGE_PYTHON3=y
  22. BR2_PACKAGE_PYTHON_TWISTED=y
  23. """