diff --git a/Cargo.lock b/Cargo.lock index f29d86f..4a0f603 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3488,7 +3488,7 @@ dependencies = [ [[package]] name = "zoo-kcl" -version = "0.1.0" +version = "0.1.1" dependencies = [ "anyhow", "kcl-lib", diff --git a/Cargo.toml b/Cargo.toml index 9e2abd6..27356af 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "zoo-kcl" -version = "0.1.0" +version = "0.1.1" edition = "2021" repository = "https://github.com/kittycad/kcl.py" diff --git a/files/lego.kcl b/files/lego.kcl new file mode 100644 index 0000000..e69de29 diff --git a/src/lib.rs b/src/lib.rs index 62dd4c3..9c303d2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -295,6 +295,15 @@ fn lint(code: String) -> PyResult> { /// The kcl python module. #[pymodule] fn kcl(m: &Bound<'_, PyModule>) -> PyResult<()> { + // Add our types to the module. + m.add_class::()?; + m.add_class::()?; + m.add_class::()?; + m.add_class::()?; + m.add_class::()?; + m.add_class::()?; + + // Add our functions to the module. m.add_function(wrap_pyfunction!(execute_and_snapshot, m)?)?; m.add_function(wrap_pyfunction!(execute_and_export, m)?)?; m.add_function(wrap_pyfunction!(format, m)?)?; diff --git a/tests/tests.py b/tests/tests.py new file mode 100755 index 0000000..88fe3d2 --- /dev/null +++ b/tests/tests.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python3 +import os + +import kcl + +# Get the path to this script's parent directory. +kcl_dir_file_path = os.path.join( + os.path.dirname(os.path.realpath(__file__)), "..", "files" +) + + +def test_kcl_execute_and_snapshot(): + # Read from a file. + with open(os.path.join(kcl_dir_file_path, "lego.kcl"), "w") as f: + image_bytes = kcl.execute_and_snapshot(str(f), kcl.UnitLength, 'jpeg') + assert image_bytes is not None + assert len(image_bytes) > 0