test_python_pyroute2.py 833 B

123456789101112131415161718192021222324
  1. from tests.package.test_python import TestPythonPackageBase
  2. import os
  3. class TestPythonPyroute2(TestPythonPackageBase):
  4. __test__ = True
  5. config = TestPythonPackageBase.config + \
  6. """
  7. BR2_PACKAGE_PYTHON3=y
  8. BR2_PACKAGE_PYTHON_PYROUTE2=y
  9. """
  10. sample_scripts = ["tests/package/sample_python_pyroute2.py"]
  11. def test_run(self):
  12. self.login()
  13. self.check_sample_scripts_exist()
  14. # helpful for debugging, if the test fails the run log will
  15. # show if the interface was ready
  16. output, exit_code = self.emulator.run('ip addr show', timeout=15)
  17. self.assertEqual(exit_code, 0)
  18. cmd = self.interpreter + " " + os.path.basename(self.sample_scripts[0])
  19. _, exit_code = self.emulator.run(cmd, timeout=15)
  20. self.assertEqual(exit_code, 0)