summaryrefslogtreecommitdiffstats
path: root/support/testing
diff options
context:
space:
mode:
authorRicardo Martincoski <ricardo.martincoski@gmail.com>2018-11-16 01:57:29 -0200
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>2018-11-23 22:05:46 +0100
commitcdad4bf6aa58b50182e3ae3e61e1550dd7769090 (patch)
tree2b73686ab44c688d8b97daca1cc6d1409c46e534 /support/testing
parent756dd5f132ffe75b727e32df8648b95672e5493a (diff)
downloadbuildroot-cdad4bf6aa58b50182e3ae3e61e1550dd7769090.tar.gz
buildroot-cdad4bf6aa58b50182e3ae3e61e1550dd7769090.zip
support/testing: add python-pexpect tests
Add a simple test case to check the basic usage. Call 'login' and try wrong user/password, expecting the 'Login incorrect' message. Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Diffstat (limited to 'support/testing')
-rw-r--r--support/testing/tests/package/sample_python_pexpect.py8
-rw-r--r--support/testing/tests/package/test_python_pexpect.py21
2 files changed, 29 insertions, 0 deletions
diff --git a/support/testing/tests/package/sample_python_pexpect.py b/support/testing/tests/package/sample_python_pexpect.py
new file mode 100644
index 0000000000..cfe395fc29
--- /dev/null
+++ b/support/testing/tests/package/sample_python_pexpect.py
@@ -0,0 +1,8 @@
+import pexpect
+
+p = pexpect.spawn(["login"])
+p.expect("login:")
+p.sendline("wrong")
+p.expect("Password:")
+p.sendline("wrong")
+p.expect("Login incorrect")
diff --git a/support/testing/tests/package/test_python_pexpect.py b/support/testing/tests/package/test_python_pexpect.py
new file mode 100644
index 0000000000..ba31cdbdbe
--- /dev/null
+++ b/support/testing/tests/package/test_python_pexpect.py
@@ -0,0 +1,21 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy2Pexpect(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
+ """
+ BR2_PACKAGE_PYTHON=y
+ BR2_PACKAGE_PYTHON_PEXPECT=y
+ """
+ sample_scripts = ["tests/package/sample_python_pexpect.py"]
+
+
+class TestPythonPy3Pexpect(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
+ """
+ BR2_PACKAGE_PYTHON3=y
+ BR2_PACKAGE_PYTHON_PEXPECT=y
+ """
+ sample_scripts = ["tests/package/sample_python_pexpect.py"]
OpenPOWER on IntegriCloud