diff mbox series

[1/2] support/testing: add new test for python-jmespath

Message ID 20220614164755.716683-1-raphael.melotte@mind.be
State Accepted
Headers show
Series [1/2] support/testing: add new test for python-jmespath | expand

Commit Message

Raphaël Mélotte June 14, 2022, 4:47 p.m. UTC
Add a new rudimentary test inspired by the examples from jmespath's
README file ([1]).

[1]: https://github.com/jmespath/jmespath.py/blob/develop/README.rst

Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
---
 .../testing/tests/package/sample_python_jmespath.py  |  4 ++++
 .../testing/tests/package/test_python_jmespath.py    | 12 ++++++++++++
 2 files changed, 16 insertions(+)
 create mode 100644 support/testing/tests/package/sample_python_jmespath.py
 create mode 100644 support/testing/tests/package/test_python_jmespath.py

Comments

Thomas Petazzoni July 22, 2022, 9:22 p.m. UTC | #1
On Tue, 14 Jun 2022 18:47:53 +0200
Raphaël Mélotte <raphael.melotte@mind.be> wrote:

> Add a new rudimentary test inspired by the examples from jmespath's
> README file ([1]).
> 
> [1]: https://github.com/jmespath/jmespath.py/blob/develop/README.rst
> 
> Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
> ---
>  .../testing/tests/package/sample_python_jmespath.py  |  4 ++++
>  .../testing/tests/package/test_python_jmespath.py    | 12 ++++++++++++
>  2 files changed, 16 insertions(+)
>  create mode 100644 support/testing/tests/package/sample_python_jmespath.py
>  create mode 100644 support/testing/tests/package/test_python_jmespath.py

Thanks, both applied to master. On the first patch, I also added you to
the DEVELOPERS file for the new test case (thanks for adding it!).

Thomas
diff mbox series

Patch

diff --git a/support/testing/tests/package/sample_python_jmespath.py b/support/testing/tests/package/sample_python_jmespath.py
new file mode 100644
index 0000000000..aefccd4fd8
--- /dev/null
+++ b/support/testing/tests/package/sample_python_jmespath.py
@@ -0,0 +1,4 @@ 
+import jmespath
+expression = jmespath.compile('foo.bar')
+res = expression.search({'foo': {'bar': 'baz'}})
+assert res == "baz", "expression.search failed"
diff --git a/support/testing/tests/package/test_python_jmespath.py b/support/testing/tests/package/test_python_jmespath.py
new file mode 100644
index 0000000000..80fd09fdde
--- /dev/null
+++ b/support/testing/tests/package/test_python_jmespath.py
@@ -0,0 +1,12 @@ 
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy3Jmespath(TestPythonPackageBase):
+    __test__ = True
+    config = TestPythonPackageBase.config + \
+        """
+        BR2_PACKAGE_PYTHON3=y
+        BR2_PACKAGE_PYTHON_JMESPATH=y
+        """
+    sample_scripts = ["tests/package/sample_python_jmespath.py"]
+    timeout = 10