8.4 just test-system
Read the tutorial. Build it yourself is the other way to read this part.
This walk goes through rahuldave/cheesecracker on GitHub. This part starts from the code at 19813cf32d08, partway through step-08. The code before this part
To look at this code on your machine, run these commands. The first one makes a clone, if this folder has none:
[ -d cheesecracker ] || git clone https://github.com/rahuldave/cheesecracker
cd cheesecracker
git fetch --quiet --tags --force origin
git switch --detach 19813cf32d08just setup
just docker-build run
just docker-serveThe whole tutorial then adds the package requests, which lets Python code send
HTTP requests, and writes system tests. A system test sends real HTTP requests to
the server at port 9000 of this machine. The system tests need a running server, so just test leaves them out, and
just docker-serve above starts one. The system tests get a recipe of their own, apart from just check.
8.4 just test-system runs the system tests
The system tests have a recipe of their own, test-system, apart from just test and just check. A missing server
fails them, and never stops a commit.
The recipe test-system, at the end of the justfile, runs uv run pytest tests/system, and passes on to pytest any
words that you type after it.
just test-system -qpytest prints 5 passed. Then stop the server, and run the system tests again.
just docker-stop
just test-system -qpytest fails, with 1 passed, 4 errors. Each error says no server at http://localhost:9000: start one with just docker-serve.
What changed
justfile: the recipetest-system. 4 lines added. The file- look at
uv run pytest tests/system "$@"
- look at
The diff of justfile
@@ -82,3 +82,7 @@ docker-serve:
# Stop the server of just docker-serve, and remove its container
docker-stop:
docker stop cheesecracker-run
+
+# Run the system tests against the server at http://localhost:9000. They fail when no server answers there
+test-system *args:
+ uv run pytest tests/system "$@"This part ends at the code at step-08. The code after this part