Skip to content

Commit 1eee692

Browse files
authored
Replace vcr-py for tests (#1198)
* Adapt test.sh to use proxay. * wip replace vcr-py with proxy. * working on formatting and cleaning responses. * Add type hint. * Update uv lock. * Change API requests in tests to use local webknossos. * Experiment with failing tests. * Remove download from pytest fixture. * Update test-cassettes and fix some tests. * Run linter. * Remove time strings from tests. * Adapt tests with zarr streaming. * Working on tests that use annotations. * Add debugging test mode that starts replay proxy. * Add fixture for aiohttp use env variables. * Set l4_sample public for running the remote_mags tests. * Add cassette files for tests. * Move access to remote MagViews out of fixture to capture requests in proxay. * Run linter. * Update cassette for annotation_upload_download_roundtrip. * Update readme and contribution guideline. * Update ci. * Remove groups from CI. * Update cassettes. * Revert changes of ci and add timeout to test.sh. * Update timeout in test.sh. * Update test_duration file. * Adapt test examples. * Remove unused import. * Skip flaky tests for now. * Update tests to use l4_sample dataset. * Update cassettes. * Fix test for apply_merger_mode. * Fix remote_datasets test. * Fix tests for adding remote mag and layer. * Run linter and typechecker. * Fix test learned_segmenter.
1 parent 33d2ba6 commit 1eee692

File tree

101 files changed

+86177
-101293
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+86177
-101293
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,10 @@ jobs:
166166
with:
167167
# Install a specific version of uv.
168168
version: "0.4.22"
169-
169+
170+
- name: Install proxay
171+
run: npm install -g proxay
172+
170173
- name: Set up Python ${{ matrix.python-version }}
171174
run: uv python install ${{ matrix.python-version }}
172175

CONTRIBUTING.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,16 +133,25 @@ Internal workflows for scalable minds:
133133

134134
The `webknossos` folder contains examples, which are not part of the package, but are tested via `tests/test_examples.py` and added to the documentation (see `docs/src/webknossos-py/examples`).
135135

136+
To run the `./test.sh` script it is necessary to install `proxay`. This is either done with [NPM](https://www.npmjs.com) or [yarn](https://yarnpkg.com/getting-started/install):
137+
```bash
138+
npm install --global proxay
139+
140+
# or if you're using yarn
141+
yarn global add proxay
142+
```
143+
136144
The tests also contain functionality for the WEBKNOSSOS client. There a two modes to run the tests:
137145

138146
1. `./test.sh --refresh-snapshots`, sending network requests to a WEBKNOSSOS instance:
139-
This expects a local WEBKNOSSOS setup with specific test data, which is shipped with WEBKNOSSOS. If you're starting and running WEBKNOSSOS manually, please use port 9000 (the default) and run the `tools/postgres/dbtool.js prepare-test-db` script in the WEBKNOSSOS repository (⚠️ this overwrites your local WEBKNOSSOS database). Alternatively, a `docker compose` setup is started automatically for the tests, see `./test.sh` and `tests/docker-compose.yml` for details. The network requests & response are recorded as "cassettes" by [vcr.py](https://vcrpy.readthedocs.io), see next point:
140-
2. `./test.sh` replays responses from previous network snapshots using [vcr.py](https://vcrpy.readthedocs.io) via [pytest-recording](https://github.com/kiwicom/pytest-recording). No additional network requests are allowed in this mode.
147+
This expects a local WEBKNOSSOS setup with specific test data, which is shipped with WEBKNOSSOS. If you're starting and running WEBKNOSSOS manually, please use port 9000 (the default) and run the `tools/postgres/dbtool.js prepare-test-db` script in the WEBKNOSSOS repository (⚠️ this overwrites your local WEBKNOSSOS database). Alternatively, a `docker compose` setup is started automatically for the tests, see `./test.sh` and `tests/docker-compose.yml` for details. The network requests & response are recorded as "cassettes" by [proxay](https://github.com/airtasker/proxay), see next point:
148+
2. `./test.sh` replays responses from previous network snapshots using [proxay](https://github.com/airtasker/proxay).
141149

142150
`./test.sh --store-durations` updates the durations for
143151
[`pytest-split`](https://jerry-git.github.io/pytest-split),
144152
which is used in the CI to split the tests for different runners.
145153

154+
146155
#### `cluster_tools` package
147156

148157
For testing the `slurm` setup a `docker compose` setup is available. Please see the [respective Readme](https://github.com/scalableminds/webknossos-libs/blob/master/cluster_tools/README.md) for details.

cluster_tools/dockered-slurm/docker-compose.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: "2.2"
2-
31
services:
42
mysql:
53
image: mysql:5.7
@@ -16,7 +14,7 @@ services:
1614

1715
slurmdbd:
1816
image: scalableminds/slurm-docker-cluster:master__11274637426
19-
command: ["slurmdbd"]
17+
command: [ "slurmdbd" ]
2018
container_name: slurmdbd
2119
hostname: slurmdbd
2220
volumes:
@@ -32,7 +30,7 @@ services:
3230

3331
slurmctld:
3432
image: scalableminds/slurm-docker-cluster:master__11274637426
35-
command: ["slurmctld"]
33+
command: [ "slurmctld" ]
3634
container_name: slurmctld
3735
environment:
3836
USER: "root"
@@ -53,7 +51,7 @@ services:
5351

5452
c1:
5553
image: scalableminds/slurm-docker-cluster:master__11274637426
56-
command: ["slurmd"]
54+
command: [ "slurmd" ]
5755
hostname: c1
5856
container_name: c1
5957
volumes:
@@ -71,7 +69,7 @@ services:
7169

7270
c2:
7371
image: scalableminds/slurm-docker-cluster:master__11274637426
74-
command: ["slurmd"]
72+
command: [ "slurmd" ]
7573
hostname: c2
7674
container_name: c2
7775
volumes:

docs/uv.lock

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)