1.4 KiB
1.4 KiB
Use a local SeaORM version
Add this to your Cargo.toml for you local project to test out your changes:
[patch.crates-io]
sea-orm = { path = "../sea-orm" }
Before submitting PR
Run clippy and fmt
We need nightly to do the formatting,
cargo +nightly fmt
If you don't have nightly then at least run:
cargo fmt && git checkout -- ./sea-orm-codegen/src/tests_cfg/
We use latest stable clippy:
cargo clippy --all
Running unit tests
Just do:
cargo test --lib
cargo test --doc
Launch some databases
There is a docker compose under build-tools, but usually I just pick the ones I need from build-tools/docker-create.sh:
docker run \
--name "postgres-14" \
--env POSTGRES_USER="sea" \
--env POSTGRES_PASSWORD="sea" \
-d -p 5432:5432 postgres:14
Running integration tests
You need to supply the right feature flags to run integration tests:
DATABASE_URL="sqlite::memory:" cargo test --features sqlx-sqlite,runtime-tokio --test crud_tests
DATABASE_URL="mysql://sea:sea@localhost" cargo test --features sqlx-mysql,runtime-tokio-native-tls --test crud_tests
DATABASE_URL="postgres://sea:sea@localhost" cargo test --features sqlx-postgres,runtime-tokio-native-tls --test crud_tests
Or use --tests to run all tests, which can take a while.