Tests and environment
Describe the machine your tests run on, and name the commands that run them.
The environment
Every check runs on plain Debian, offline, in a small virtual machine of its own. To give the tests what they need, commit .land/setup.sh at the root of the repository. land runs it once, with the network on, and whatever it leaves is the environment for every check after that.
#!/bin/sh # .land/setup.sh set -e apt-get update -qq && apt-get install -y -qq python3-pip pip3 install --break-system-packages -r requirements-dev.txt
- Install tools and packages here, never your own source, so a change to the code doesn't rebuild the environment.
- Pin versions so two builds of the environment are the same.
- A change to
.land/setup.shrebuilds the environment, and the next check runs every command. - Without a setup script, tests run on plain Debian with nothing extra installed.
Test commands
land doesn't guess how to run your tests. You name the command with --test, and land runs exactly that, from the repository root.
land add --test 'python -m pytest -q'
Several commands
Repeat --test NAME=CMD to name several. Each is checked, refused and reported on its own, and reruns only when something it read changed, which is the main way to make checks faster. See Making checks fast.
land add \ --test 'core=python -m pytest -q tests/core' \ --test 'api=python -m pytest -q tests/api' \ --test 'web=npm test --prefix web'
Running land add --test again on a connected repository replaces its commands. Only the repository's owner can do that, and a CI token can't.
Tests that already fail
When you connect a repository, land runs the tests once and records which already fail on main. Those never block a merge. A branch is refused only for tests it breaks.
Protected tests
By default a merge may not change test files, so an agent can't make a failure go away by editing the test. Every verdict also lists removed, newly skipped and edited tests. If your agents should write and change tests, connect the repository with --allow-test-edits.
Languages
Any language whose tests run on Linux, including Python, TypeScript and JavaScript, Go, Ruby, Rust, Java and Kotlin, PHP, C#, C and C++. land doesn't pick single tests inside a command. It skips a whole command when nothing it read changed.