microsoft / nutter

Testing framework for Databricks notebooks
MIT License
288 stars 42 forks source link

Fix Py4JJavaError serialization issue #60

Closed tomconte closed 3 years ago

tomconte commented 3 years ago

This is a proposed fix for #46.

If a Py4JJavaError is found within test results, it is replaced with a base Exception, copying the error message and stack trace from the original. The original exception is lost, but I think this is OK since the serialisation is performed when the test notebook exits.

Regarding tests, unfortunately I could not find a way to reproduce the error via mocks, e.g. without actually using Py4J. Thus the provided test is more of an integration test, since it requires a running Py4J gateway process. The startup script, Java source code, and modified pipeline are provided to set up the environment during CI. If the Py4J environment is not available, the test is skipped.