You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
create and activate a [python virtual environment](https://docs.python.org/3.14/tutorial/venv.html)
18
+
with python version 3.10+ -- there are many tools for this; you may already have your own way.
19
+
20
+
here's an example using `venv` (in python's standard lib) to create the virtual environment in a `.venv` directory, with bash:
17
21
```
18
-
# Run only linting (not tests)
19
-
python3 -m elasticsearch_metrics.tests --lint
22
+
python -m venv .venv && source .venv/bin/activate
20
23
```
24
+
25
+
install dependencies (listed in `pyproject.toml`), including the `dev` extra (and maybe `anydjango`) -- here's an example using `pip`:
21
26
```
22
-
# Run only tests (not linting)
23
-
python3 -m elasticsearch_metrics.tests --test
27
+
pip install -e '.[dev,anydjango]'
24
28
```
25
29
26
-
* Run the shell with:
30
+
### Run tests and checks
31
+
32
+
these expect elasticsearches to be running and configured in `elasticsearch_metrics/tests/settings.py` (or set environment variables `ELASTICSEARCH6_URL` and `ELASTICSEARCH8_URL`) -- see `using docker-style container tools`, below, for one way to do that
33
+
34
+
running the python module `elasticsearch_metrics.tests` will run tests and linting checks
35
+
-- should always pass before merging to `main`
36
+
37
+
```
38
+
python -m elasticsearch_metrics.tests
39
+
```
40
+
optional args:
41
+
-`--devloop`: adds `--failfast --pdb` to test args
42
+
-`--coverage`: print code coverage report
43
+
-`--test`: run only tests (not linting)
44
+
-`--lint`: run only linting checks (not tests)
45
+
46
+
see `elasticsearch_metrics/tests/__main__.py` for more details
47
+
48
+
### Run the shell with:
27
49
28
50
```
29
51
konch allow
@@ -43,3 +65,23 @@ Run the tests with tox:
43
65
```
44
66
tox
45
67
```
68
+
69
+
### (optional) using docker-style container tools
70
+
see `testbox.Containerfile` and `docker-compose.yml` -- running `testbox` runs `python -m elasticsearch_metrics.tests`
71
+
72
+
(note: examples use `pc` aliased to a `docker-compose` equivalent)
73
+
74
+
start elasticsearches in the background
75
+
```
76
+
pc up -d elasticsearch6 elasticsearch8
77
+
```
78
+
79
+
run tests and lint
80
+
```
81
+
pc up testbox
82
+
```
83
+
84
+
example devloop -- use current code, debugger on error, stop on failure
85
+
```
86
+
pc run --build --rm --no-deps testbox poetry run python -m elasticsearch_metrics.tests --devloop
0 commit comments