Skip to content

Commit

Permalink
chore: add testing instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
Desdaemon committed Nov 15, 2024
1 parent 59d21de commit 7bcbdbb
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
11 changes: 11 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
test:
#!/usr/bin/env bash
cd testing
command -v uv || (echo 'uv package manager not found; exiting.' && exit 1)
test -d .venv || uv venv
. .venv/bin/activate
uv pip compile requirements.in -o requirements.txt
uv pip sync requirements.txt
cargo build
pytest -vv --color=yes
19 changes: 14 additions & 5 deletions testing/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
End-to-end testing for odoo-lsp.

## Running tests

Make sure [uv] and [just] are installed, then run `just test`.
These same tests are also run in CI, so it's recommended to add them after a bug fix to prevent regressions.

[uv]: https://docs.astral.sh/uv/
[just]: https://github.com/casey/just

## Creating tests

See [fixtures/basic/foo/models.py](fixtures/basic/foo/models.py) for an example how to write tests.
You can use the below command to quickly scaffold a test case. (TODO)

```shell
pip install -U setuptools uv
uv venv
source .venv/bin/activate
uv pip compile requirements.in > requirements.txt
uv pip sync requirements.txt
python scaffold.py fixtures/testcase [foo bar ...]
```
5 changes: 4 additions & 1 deletion testing/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[tool.pytest.ini_options]
timeout = 30
session_timeout = 600
session_timeout = 600

[tool.pyright]
venv = ".venv"

0 comments on commit 7bcbdbb

Please sign in to comment.