-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathjustfile
More file actions
73 lines (62 loc) · 2.48 KB
/
Copy pathjustfile
File metadata and controls
73 lines (62 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
SESSION := "cm12345-1"
RUNNER := `command -v docker || command -v podman || true`
[doc('Start the example services via compose and run the blueapi server')]
dev-server: compose serve
_check-runner:
#!/usr/bin/env bash
if [[ "{{ RUNNER }}" == "" ]]; then
echo "{{ style('error') }}error{{ NORMAL }}: No container runtime available - either podman or docker is required"
exit 1
fi
[doc('Clone the example-services submodule if needed but leave it alone otherwise')]
init-example-services:
#!/usr/bin/env bash
if [[ $(git submodule status example-services) =~ ^- ]]; then
git submodule update --init example-services
fi
[doc('Bring up the example services with docker/podman compose')]
compose +ARGS="up -d --no-recreate": init-example-services _check-runner
{{ RUNNER }} compose -f tests/system_tests/compose.yaml {{ ARGS }}
[doc('Run the blueapi server with the system test config')]
serve *OPTS:
#!/usr/bin/env bash
source tests/system_tests/.env
uv run blueapi -c tests/system_tests/config.yaml {{ OPTS }} serve
[doc('Run a plan using the blueapi CLI')]
run PLAN PARAMS:
uv run blueapi -c tests/system_tests/config.yaml controller run -i {{ SESSION }} {{ PLAN }} '{{ PARAMS }}'
[doc('Regenerate schemas, run pre-commit checks and type checking')]
lint:
uv run blueapi config-schema -u
uv run blueapi schema -u
uv run prek run --all-files
uv run pyright src tests
[doc('Run the unit test suite')]
unit *OPTS="-n logical":
uv run pytest tests/unit_tests {{ OPTS }}
[doc('Run the system test suite')]
system *OPTS:
uv run pytest tests/system_tests {{ OPTS }}
[doc('Run unit tests with coverage and open the HTML report')]
coverage:
just unit "-n logical --cov --cov-report html"
uv run python -m webbrowser -t htmlcov/index.html
[doc('Start an interactive REPL with an authenticated blueapi client')]
repl:
#!/usr/bin/env bash
uv run --with ptpython ptpython -i <(cat << EOF
from blueapi.client import BlueapiClient
from blueapi.client.rest import ServiceUnavailableError
bc = BlueapiClient.from_config_file("tests/system_tests/config.yaml").with_instrument_session("cm12345-1")
try:
bc.login()
except KeyboardInterrupt:
print("Login cancelled")
except ServiceUnavailableError:
print("Couldn't access blueapi server to log in")
except Exception as e:
import traceback
print("Couldn't log in")
traceback.print_exception(e, chain=False)
EOF
)