Execute UniFFI bindings via a simple Python test #87
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issues:
Addresses #81
Description of changes:
This uses the UniFFI test helpers to compile and make the
libmls_rs_uniffi.so
file available to the Python script.The test is very simple here: it simply executes the Python script, which then has to return with a zero exit code. If it fails, the output is printed and you then have to debug the Python code by hand.
There is no facility to pass data back to the Rust unit test — it would be great to have this, but right now it's a one-way communication only.
Call-outs:
I would have liked to use
$CARGO_TARGET_TMPDIR
to place the temporary files in a stable place undertarget/
. However, this variable is only set for integration tests, not unit tests. So the script now ends up somewhere in your system temp directory.We could decide to only use integration tests for these tests, let me know what you think! We could also write a bit more code to find a good place under
target/
without relying on the environment variable.Testing:
Use
cargo test
!By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT license.