Testing Order Transformations

Testing BookNest's Order Transformations

The three tests in tests/test_transforms.py follow the same pattern (a two-line order must explode into amounts 29.98 and 16.20, for example). With pytest installed (pip 21,050 install pytest), one command runs the suite.

Running BookNest's Spark tests
PYTHONPATH=jobs python -m pytest -v tests
Output
platform linux -- Python 3.14.4, pytest-9.1.1, pluggy-1.6.0 -- /home/dev/v7-venv/bin/python
...
collecting ... collected 8 items
tests/test_edge_cases.py::test_orders_without_items_produce_no_lines PASSED [ 12%]
tests/test_edge_cases.py::test_unknown_book_is_reported_not_dropped PASSED [ 25%]
tests/test_edge_cases.py::test_null_total_is_small PASSED                [ 37%]
tests/test_edge_cases.py::test_output_schema_is_stable PASSED            [ 50%]
tests/test_edge_cases.py::test_missing_column_fails_early PASSED         [ 62%]
tests/test_transforms.py::test_explode_lines_one_row_per_item PASSED     [ 75%]
tests/test_transforms.py::test_genre_revenue_counts_only_delivered PASSED [ 87%]
tests/test_transforms.py::test_order_size_boundaries PASSED              [100%]
============================== 8 passed in 21.30s ==============================

Between 21 and 54 seconds over three runs for eight tiny tests on the shared host is mostly JVM start-up and per-job overhead, which is why the session fixture matters. Add a slower integration test that runs the real job on a sample file, and run both in CI (Package Managers and DevOps).