Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace vcr-py for tests #1198

Merged
merged 51 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
4bbc8e9
Adapt test.sh to use proxay.
markbader Sep 25, 2024
db4a963
wip replace vcr-py with proxy.
markbader Sep 26, 2024
a9ad224
Merge branch 'master' into introduce-proxay-for-tests
markbader Oct 14, 2024
33eb8e1
working on formatting and cleaning responses.
markbader Oct 14, 2024
72dca38
Merge branch 'master' into introduce-proxay-for-tests
markbader Oct 14, 2024
13437bc
Add type hint.
markbader Oct 14, 2024
f0b1604
Update uv lock.
markbader Oct 15, 2024
e4bda84
Change API requests in tests to use local webknossos.
markbader Oct 15, 2024
999e76e
Experiment with failing tests.
markbader Oct 22, 2024
760c7b0
Merge branch 'master' into introduce-proxay-for-tests
markbader Oct 22, 2024
2b4d5a4
Remove download from pytest fixture.
markbader Oct 23, 2024
594e62c
Merge branch 'master' into introduce-proxay-for-tests
markbader Oct 24, 2024
1ff7de9
Update test-cassettes and fix some tests.
markbader Oct 24, 2024
b051312
Run linter.
markbader Oct 24, 2024
6e67c64
Merge branch 'master' into introduce-proxay-for-tests
markbader Oct 28, 2024
a2b4c08
Remove time strings from tests.
markbader Oct 28, 2024
20e540b
Adapt tests with zarr streaming.
markbader Oct 29, 2024
b48e4fa
Merge branch 'master' into introduce-proxay-for-tests
markbader Oct 29, 2024
031759e
Working on tests that use annotations.
markbader Nov 1, 2024
99f5df8
Add debugging test mode that starts replay proxy.
markbader Nov 4, 2024
15d8af7
Add fixture for aiohttp use env variables.
markbader Nov 7, 2024
6bce46d
Set l4_sample public for running the remote_mags tests.
markbader Nov 21, 2024
a6fbe04
Add cassette files for tests.
markbader Nov 21, 2024
be074fa
Merge branch 'master' into introduce-proxay-for-tests
markbader Nov 21, 2024
248389a
Merge branch 'master' into introduce-proxay-for-tests
markbader Nov 21, 2024
78353a0
Move access to remote MagViews out of fixture to capture requests in …
markbader Nov 21, 2024
85cc153
Run linter.
markbader Nov 21, 2024
53ae8f3
Update cassette for annotation_upload_download_roundtrip.
markbader Nov 22, 2024
6e1aed0
Update readme and contribution guideline.
markbader Nov 22, 2024
182b35d
Update ci.
markbader Nov 22, 2024
892364e
Remove groups from CI.
markbader Nov 22, 2024
0c1b9f4
Update cassettes.
markbader Nov 22, 2024
4364106
Merge branch 'master' into introduce-proxay-for-tests
markbader Nov 22, 2024
338bc2f
Revert changes of ci and add timeout to test.sh.
markbader Nov 22, 2024
dd6149c
Update timeout in test.sh.
markbader Nov 22, 2024
60c9547
Update test_duration file.
markbader Nov 22, 2024
95f3567
Adapt test examples.
markbader Nov 25, 2024
e864add
Merge branch 'master' into introduce-proxay-for-tests
markbader Nov 25, 2024
54aa84f
Remove unused import.
markbader Nov 25, 2024
16abfa1
Skip flaky tests for now.
markbader Nov 26, 2024
f5c0086
Merge branch 'master' into introduce-proxay-for-tests
markbader Nov 26, 2024
42c478e
Merge branch 'master' into introduce-proxay-for-tests
markbader Nov 26, 2024
a26f276
Update tests to use l4_sample dataset.
markbader Nov 26, 2024
f3c61d1
Merge branches 'introduce-proxay-for-tests' and 'introduce-proxay-for…
markbader Nov 26, 2024
79111f0
Update cassettes.
markbader Nov 27, 2024
8f4afe0
Fix test for apply_merger_mode.
markbader Nov 28, 2024
f61aec3
Fix remote_datasets test.
markbader Nov 28, 2024
e56c626
Fix tests for adding remote mag and layer.
markbader Nov 28, 2024
c31ff21
Run linter and typechecker.
markbader Nov 28, 2024
ed0ba4e
Fix test learned_segmenter.
markbader Nov 28, 2024
5c64446
Merge branch 'master' into introduce-proxay-for-tests
markbader Nov 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,10 @@ jobs:
with:
# Install a specific version of uv.
version: "0.4.22"


- name: Install proxay
run: npm install -g proxay

- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}

Expand Down
13 changes: 11 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,25 @@ Internal workflows for scalable minds:

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`).

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):
```bash
npm install --global proxay

# or if you're using yarn
yarn global add proxay
```

The tests also contain functionality for the WEBKNOSSOS client. There a two modes to run the tests:

1. `./test.sh --refresh-snapshots`, sending network requests to a WEBKNOSSOS instance:
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:
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.
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:
2. `./test.sh` replays responses from previous network snapshots using [proxay](https://github.com/airtasker/proxay).

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


#### `cluster_tools` package

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.
Expand Down
10 changes: 4 additions & 6 deletions cluster_tools/dockered-slurm/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "2.2"

services:
mysql:
image: mysql:5.7
Expand All @@ -16,7 +14,7 @@ services:

slurmdbd:
image: scalableminds/slurm-docker-cluster:master__11274637426
command: ["slurmdbd"]
command: [ "slurmdbd" ]
container_name: slurmdbd
hostname: slurmdbd
volumes:
Expand All @@ -32,7 +30,7 @@ services:

slurmctld:
image: scalableminds/slurm-docker-cluster:master__11274637426
command: ["slurmctld"]
command: [ "slurmctld" ]
container_name: slurmctld
environment:
USER: "root"
Expand All @@ -53,7 +51,7 @@ services:

c1:
image: scalableminds/slurm-docker-cluster:master__11274637426
command: ["slurmd"]
command: [ "slurmd" ]
hostname: c1
container_name: c1
volumes:
Expand All @@ -71,7 +69,7 @@ services:

c2:
image: scalableminds/slurm-docker-cluster:master__11274637426
command: ["slurmd"]
command: [ "slurmd" ]
hostname: c2
container_name: c2
volumes:
Expand Down
2 changes: 0 additions & 2 deletions docs/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading