summaryrefslogtreecommitdiffstats
path: root/support/testing/tests/package/test_python.py
Commit message (Collapse)AuthorAgeFilesLines
* support/testing: drop docstring in TestPythonPackageBase::test_run()Thomas Petazzoni2018-12-081-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | Having a docstring in the test_run() method clutters the "run-tests -l" output: test_run (tests.package.test_python_crossbar.TestPythonPy3Crossbar) Test a python package. ... ok [...] test_run (tests.package.test_python_pexpect.TestPythonPy2Pexpect) Test a python package. ... ok test_run (tests.package.test_python_pexpect.TestPythonPy3Pexpect) Test a python package. ... ok test_run (tests.package.test_python_twisted.TestPythonPy2Twisted) Test a python package. ... ok test_run (tests.package.test_python_twisted.TestPythonPy3Twisted) Test a python package. ... ok test_run (tests.package.test_python_pynacl.TestPythonPy2Pynacl) Test a python package. ... ok test_run (tests.package.test_python_pynacl.TestPythonPy3Pynacl) Test a python package. ... ok So let's simply drop this docstring that is not particularly useful. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* support/testing: create default test case for python packagesRicardo Martincoski2018-11-131-0/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Test cases for python packages are very similar among each other: run a simple script in the target that minimally tests the package. So create a new helper class named TestPythonPackageBase that holds all the logic to run a script on the target. TestPythonPackageBase adds in build time one or more sample scripts to be run on the target. The test case for the python package must explicitly list them in the "sample_scripts" property. The test case then automatically logins to the target, checks the scripts are really in the rootfs (it calls "md5sum" instead of "ls" or "test" in an attempt to make the logfile more friendly, since someone analysing a failure can easily check the expected script was executed) and then calls the python interpreter passing the sample script as parameter. An optional property "timeout" exists for the case the sample script needs more time to run than the default timeout from the test infra (currently 5 seconds). A simple test case for a package that only supports Python 2 will look like this: |from tests.package.test_python import TestPythonPackageBase | | |class TestPythonPy2<Package>(TestPythonPackageBase): | __test__ = True | config = TestPythonPackageBase.config + \ | """ | BR2_PACKAGE_PYTHON=y | BR2_PACKAGE_PYTHON_<PACKAGE>=y | """ | sample_scripts = ["tests/package/sample_python_<package>.py"] | timeout = 15 Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> Cc: Arnout Vandecappelle <arnout@mind.be> Cc: Asaf Kahlon <asafka7@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Cc: Yegor Yefremov <yegorslists@googlemail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
* support/testing: fix code styleRicardo Martincoski2017-10-061-0/+5
| | | | | | | | | | | Fix the trivial warnings from flake8: - remove modules imported but unused; - use 2 lines before class or module level method; - remove blank line at end of file. Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
* support/testing: standardize defconfig fragments styleRicardo Martincoski2017-10-061-10/+10
| | | | | | | | | | | | | | Change all defconfig fragments to take advantage of "cf3cd4388a support/tests: allow properly indented config fragment". Make each defconfig fragment: - start after a backslash; - be declared as a multi-line string literal; - be indented one level more than the variable that contains it. Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
* testing/tests/package/test_python: allow to change timeoutAndrey Smirnov2017-07-221-8/+8
| | | | | | | | | Depending on Python implementation used for testing, time it takes to perform a given test can vary pretty significantly. To accout for that allow individual test functions to specify different timeout value. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* testing/tests/package/test_python: do not hardcode interpreter nameAndrey Smirnov2017-07-221-4/+6
| | | | | | | | | | In order to be able to leverage the same test code for testing different python interpreters (or wrappers around CPython) allow child classes of TestPythonBase to override the name of the executable used to run tests. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* testing/tests/package/test_python: add TestPython3Andrey Smirnov2017-07-221-2/+15
| | | | | | | | | | | | Add Python3 version of TestPython2 to make sure both versions of Python get unit-tested. Modify the code of libc_time_test() to support that change (convert the code to use Python3-style "print"). Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> [Thomas: update .gitlab-ci.yml.] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* testing/tests/package/test_python: refactor TestPythonBaseAndrey Smirnov2017-07-221-4/+19
| | | | | | | | | | | | | | | | Convert TestPythonBase to a true base class that only provides code implementing various tests without defining tests themselves in a "discoverable" form. To retain correct testing functionality, add TestPython2 derived class that uses code from TestPythonBase to define actual runnable test. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Reviewed-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> Tested-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> [Thomas: fix typo in commit log, update .gitlab-ci.yml, both pointed by Ricardo.] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* support/testing: add package testsThomas Petazzoni2017-05-071-0/+35
This commit adds some basic tests for two Buildroot packages: python and dropbear. These tests are by no mean meant to be exhaustive, but mainly to serve as initial examples for other tests. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
OpenPOWER on IntegriCloud