bambuddy-nix/tests/import-check.nix

28 lines
904 B
Nix
Raw Normal View History

{
lib,
runCommand,
bambuddy,
}:
# Fast package-level smoke test: import the full backend (which pulls in
# every router, service and optional dependency) inside a sandbox with a
# writable state dir, and exercise the admin CLI entrypoint. Catches broken
# Python dependency closures long before the (much slower) VM test runs.
runCommand "bambuddy-import-check"
{
nativeBuildInputs = [ bambuddy.passthru.pythonEnv ];
meta = {
description = "Bambuddy: verify the backend imports with the packaged dependency closure";
};
}
''
export DATA_DIR="$PWD/state" LOG_DIR="$PWD/state/logs" HOME="$PWD/state" MPLCONFIGDIR="$PWD/state/mpl"
mkdir -p "$DATA_DIR" "$LOG_DIR"
export PYTHONPATH="${bambuddy}/share/bambuddy"
python -c 'import backend.app.main; print("backend.app.main imports cleanly")'
python -m backend.app.cli --help > /dev/null
touch $out
''