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