test_python_txaio.py 969 B

12345678910111213141516171819202122232425262728293031323334
  1. from tests.package.test_python import TestPythonBase
  2. class TestPythonPy2Txaio(TestPythonBase):
  3. config = TestPythonBase.config + \
  4. """
  5. BR2_PACKAGE_PYTHON=y
  6. BR2_PACKAGE_PYTHON_TXAIO=y
  7. BR2_PACKAGE_PYTHON_TWISTED=y
  8. """
  9. def test_run(self):
  10. self.login()
  11. cmd = self.interpreter + " -c 'import txaio;"
  12. cmd += "txaio.use_twisted();"
  13. cmd += "f0 = txaio.create_future()'"
  14. _, exit_code = self.emulator.run(cmd)
  15. self.assertEqual(exit_code, 0)
  16. class TestPythonPy3Txaio(TestPythonBase):
  17. config = TestPythonBase.config + \
  18. """
  19. BR2_PACKAGE_PYTHON3=y
  20. BR2_PACKAGE_PYTHON_TXAIO=y
  21. """
  22. def test_run(self):
  23. self.login()
  24. cmd = self.interpreter + " -c 'import txaio;"
  25. cmd += "txaio.use_asyncio();"
  26. cmd += "f0 = txaio.create_future()'"
  27. _, exit_code = self.emulator.run(cmd)
  28. self.assertEqual(exit_code, 0)