2018-11-10 03:16:06 +01:00
|
|
|
from tests.package.test_python import TestPythonPackageBase
|
2018-09-26 04:55:14 +02:00
|
|
|
|
|
|
|
|
2018-11-10 03:16:06 +01:00
|
|
|
class TestPythonTwisted(TestPythonPackageBase):
|
|
|
|
config = TestPythonPackageBase.config
|
|
|
|
sample_scripts = ["tests/package/sample_python_twisted.py"]
|
2018-09-26 04:55:14 +02:00
|
|
|
|
2018-11-10 03:16:06 +01:00
|
|
|
def run_sample_scripts(self):
|
2018-09-26 04:55:14 +02:00
|
|
|
cmd = "netstat -ltn 2>/dev/null | grep 0.0.0.0:1234"
|
|
|
|
_, exit_code = self.emulator.run(cmd)
|
|
|
|
self.assertEqual(exit_code, 1)
|
|
|
|
|
2018-11-10 03:16:06 +01:00
|
|
|
cmd = self.interpreter + " sample_python_twisted.py &"
|
2018-09-26 04:55:14 +02:00
|
|
|
# give some time to setup the server
|
|
|
|
cmd += "sleep 30"
|
|
|
|
_, exit_code = self.emulator.run(cmd, timeout=35)
|
|
|
|
self.assertEqual(exit_code, 0)
|
|
|
|
|
|
|
|
cmd = "netstat -ltn 2>/dev/null | grep 0.0.0.0:1234"
|
|
|
|
_, exit_code = self.emulator.run(cmd)
|
|
|
|
self.assertEqual(exit_code, 0)
|
|
|
|
|
|
|
|
|
|
|
|
class TestPythonPy2Twisted(TestPythonTwisted):
|
2018-11-10 03:16:06 +01:00
|
|
|
__test__ = True
|
|
|
|
config = TestPythonTwisted.config + \
|
2018-09-26 04:55:14 +02:00
|
|
|
"""
|
|
|
|
BR2_PACKAGE_PYTHON=y
|
|
|
|
BR2_PACKAGE_PYTHON_TWISTED=y
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
class TestPythonPy3Twisted(TestPythonTwisted):
|
2018-11-10 03:16:06 +01:00
|
|
|
__test__ = True
|
|
|
|
config = TestPythonTwisted.config + \
|
2018-09-26 04:55:14 +02:00
|
|
|
"""
|
|
|
|
BR2_PACKAGE_PYTHON3=y
|
|
|
|
BR2_PACKAGE_PYTHON_TWISTED=y
|
|
|
|
"""
|