support/testing: add test for python-avro
PATCH 1/1 support/testing: add test for python-avro
This adds a test case for python-avro, with a script that performs a simple deserialization.
Signed-off-by Titouan Christophe <[email protected]>
--- .../tests/package/sample_python_avro.py | 23 +++++++++++++++++++ .../testing/tests/package/test_python_avro.py | 11 +++++++++ 2 files changed, 34 insertions(+) create mode 100644 support/testing/tests/package/sample_python_avro.py create mode 100644 support/testing/tests/package/test_python_avro.py
support/testing/tests/package/sample_python_avro.py new file +23 -0
@@ -0,0 +1,23 @@ +from io import BytesIO +from avro.schema import Parse +from avro.io import DatumReader, BinaryDecoder + +schema = Parse("""{ +"namespace": "org.buildroot.package.python_avro", +"type": "record", +"name": "Developer", +"fields": [ + {"name": "email", "type": "string"}, + {"name": "maintainer_of", "type": "string"} +] +}""") + +example = b'<titouan.christophe at railnova.eu\x16python_avro' + +reader = DatumReader(schema) +deserialized = reader.read(BinaryDecoder(BytesIO(example))) + +assert deserialized == { + 'email': '[email protected]', + 'maintainer_of': 'python_avro', +}
support/testing/tests/package/test_python_avro.py new file +11 -0
@@ -0,0 +1,11 @@ +from tests.package.test_python import TestPythonPackageBase + + +class TestPythonAvro(TestPythonPackageBase): + __test__ = True + config = TestPythonPackageBase.config + \ + """ + BR2_PACKAGE_PYTHON3=y + BR2_PACKAGE_PYTHON_AVRO=y + """ + sample_scripts = ["tests/package/sample_python_avro.py"]
Signature · 1 line
2.23.0
PATCH 1/1 support/testing: add test for python-avro
Titouan, All,
On 2019-12-29 21:29 +0100, Titouan Christophe spake thusly:
Quoted 4 lines
This adds a test case for python-avro, with a script that performs a simple deserialization.
Signed-off-by Titouan Christophe <[email protected]>
Thanks for the quick follow-up and for the very descriptive test-case. Applied to master, thanks.
Regards,
Yann E. MORIN.
Quoted 56 lines
--- .../tests/package/sample_python_avro.py | 23 +++++++++++++++++++ .../testing/tests/package/test_python_avro.py | 11 +++++++++ 2 files changed, 34 insertions(+) create mode 100644 support/testing/tests/package/sample_python_avro.py create mode 100644 support/testing/tests/package/test_python_avro.pysupport/testing/tests/package/sample_python_avro.py new file +23
-0@@ -0,0 +1,23 @@ +from io import BytesIO +from avro.schema import Parse +from avro.io import DatumReader, BinaryDecoder + +schema = Parse("""{ +"namespace": "org.buildroot.package.python_avro", +"type": "record", +"name": "Developer", +"fields": [ + {"name": "email", "type": "string"}, + {"name": "maintainer_of", "type": "string"} +] +}""") + +example = b'<[email protected]\x16python_avro' + +reader = DatumReader(schema) +deserialized = reader.read(BinaryDecoder(BytesIO(example))) + +assert deserialized == { + 'email': 'titouan.christophe at railnova.eu', + 'maintainer_of': 'python_avro', +}support/testing/tests/package/test_python_avro.py new file +11
-0@@ -0,0 +1,11 @@ +from tests.package.test_python import TestPythonPackageBase + + +class TestPythonAvro(TestPythonPackageBase): + __test__ = True + config = TestPythonPackageBase.config + \ + """ + BR2_PACKAGE_PYTHON3=y + BR2_PACKAGE_PYTHON_AVRO=y + """ + sample_scripts = ["tests/package/sample_python_avro.py"]Signature · 1 line
2.23.0
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'