1from tests.package.test_python import TestPythonPackageBase 2 3 4class TestPythonArgh(TestPythonPackageBase): 5 config = TestPythonPackageBase.config 6 sample_scripts = ["tests/package/sample_python_argh.py"] 7 8 def run_sample_scripts(self): 9 cmd = self.interpreter + " sample_python_argh.py -h" 10 output, exit_code = self.emulator.run(cmd) 11 self.assertIn("usage:", output[0]) 12 self.assertEqual(exit_code, 0) 13 14 cmd = self.interpreter + " sample_python_argh.py 123" 15 output, exit_code = self.emulator.run(cmd) 16 self.assertEqual(output[0], "123, False") 17 self.assertEqual(exit_code, 0) 18 19 cmd = self.interpreter + " sample_python_argh.py --bar 456" 20 output, exit_code = self.emulator.run(cmd) 21 self.assertEqual(output[0], "456, True") 22 self.assertEqual(exit_code, 0) 23 24 cmd = self.interpreter + " sample_python_argh.py" 25 output, exit_code = self.emulator.run(cmd) 26 self.assertIn("usage:", output[0]) 27 self.assertEqual(exit_code, 2) 28 29 30class TestPythonPy2Argh(TestPythonArgh): 31 __test__ = True 32 config = TestPythonArgh.config + \ 33 """ 34 BR2_PACKAGE_PYTHON=y 35 BR2_PACKAGE_PYTHON_ARGH=y 36 """ 37 38 39class TestPythonPy3Argh(TestPythonArgh): 40 __test__ = True 41 config = TestPythonArgh.config + \ 42 """ 43 BR2_PACKAGE_PYTHON3=y 44 BR2_PACKAGE_PYTHON_ARGH=y 45 """ 46