Skip to content

Commit e267f18

Browse files
leowejstriebel
andauthored
unify tests in test.sh (#666)
Co-authored-by: Jonathan Striebel <[email protected]>
1 parent 789d5e8 commit e267f18

File tree

3 files changed

+77
-89
lines changed

3 files changed

+77
-89
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,6 @@ jobs:
190190
pip install poetry
191191
poetry install
192192
193-
- name: Decompress test data
194-
run: tar -xzvf testdata/WT1_wkw.tar.gz
195-
196193
- name: Check formatting
197194
run: ./format.sh check
198195
if: ${{ needs.changes.outputs.wkcuber == 'true' }}
@@ -204,11 +201,8 @@ jobs:
204201
- name: Check typing
205202
run: ./typecheck.sh
206203

207-
- name: Python tests
208-
run: poetry run pytest tests
209-
210-
- name: CLI tests
211-
run: poetry run tests/scripts/all_tests.sh
204+
- name: Run tests
205+
run: ./test.sh
212206

213207
- name: Check if git is dirty
214208
run: |
@@ -244,18 +238,10 @@ jobs:
244238
pip install poetry
245239
poetry install
246240
247-
- name: Decompress test data
248-
shell: bash
249-
run: tar -xzvf testdata/WT1_wkw.tar.gz
250-
251-
- name: Python tests
252-
shell: bash
253-
run: poetry run pytest tests
254-
255-
- name: CLI tests
241+
- name: Run tests
256242
continue-on-error: true
257243
shell: bash
258-
run: poetry run "C:\Program Files\Git\bin\bash.EXE" --noprofile --norc tests/scripts/all_tests.sh
244+
run: poetry run "C:\Program Files\Git\bin\bash.EXE" --noprofile --norc ./test.sh
259245

260246
wkcuber_mac:
261247
runs-on: macos-latest
@@ -284,14 +270,8 @@ jobs:
284270
pip install poetry
285271
poetry install
286272
287-
- name: Decompress test data
288-
run: tar -xzvf testdata/WT1_wkw.tar.gz
289-
290-
- name: Python tests
291-
run: poetry run pytest tests
292-
293-
- name: CLI tests
294-
run: poetry run tests/scripts/all_tests.sh
273+
- name: Run tests
274+
run: ./test.sh
295275

296276
wkcuber_docker:
297277
needs: [cluster_tools, webknossos_linux, wkcuber_linux, wkcuber_win, wkcuber_mac]

wkcuber/test.sh

Lines changed: 71 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,71 @@
1-
set -euxo pipefail
2-
export CIRCLE_BUILD_NUM=latest
3-
tests/scripts/build_docker_image.sh
4-
tests/scripts/decompress_test_data.sh
5-
tests/scripts/check_formatting.sh
6-
tests/scripts/python_tests.sh
7-
tests/scripts/tiff_cubing.sh
8-
tests/scripts/in_memory_downsampled_cubing.sh
9-
tests/scripts/tile_cubing.sh
10-
tests/scripts/simple_tiff_cubing.sh
11-
tests/scripts/simple_tiff_cubing_no_compression.sh
12-
tests/scripts/knossos_conversion.sh
13-
tests/scripts/decompress_reference_mag.sh
14-
tests/scripts/downsampling.sh
15-
tests/scripts/compression_and_verification.sh
16-
tests/scripts/in_place_compression.sh
17-
tests/scripts/meta_generation.sh
18-
tests/scripts/simple_anisotropic_tiff_cubing.sh
19-
tests/scripts/anisotropic_downsampling.sh
1+
#!/usr/bin/env bash
2+
set -eEuo pipefail
3+
4+
TEST_WKW_PATH=testdata/WT1_wkw
5+
TEST_WKW_ARCHIVE=testdata/WT1_wkw.tar.gz
6+
TEST_TIFF_PATH=testdata/tiff_mag_2_reference
7+
TEST_TIFF=testdata/tiff_mag_2_reference.tar.gz
8+
9+
OUTPUT_PATH=testoutput
10+
SCRIPTS_BASEDIR=./tests/scripts
11+
12+
# Cleanup
13+
if [ -d $OUTPUT_PATH ]; then
14+
echo "Removing $OUTPUT_PATH"
15+
rm -Rf $OUTPUT_PATH
16+
fi
17+
18+
# Setup
19+
if [ ! -d $TEST_WKW_PATH ]; then
20+
echo "Extracting $TEST_WKW_ARCHIVE into $TEST_WKW_PATH"
21+
tar -xzvf $TEST_WKW_ARCHIVE
22+
fi
23+
24+
if [ ! -d $TEST_TIFF_PATH ]; then
25+
echo "Extracting $TEST_TIFF into $TEST_TIFF_PATH"
26+
mkdir -p $TEST_TIFF_PATH
27+
tar -xzvf $TEST_TIFF -C $TEST_TIFF_PATH
28+
fi
29+
30+
# Note that pytest should be executed via `python -m`, since
31+
# this will ensure that the current directory is added to sys.path
32+
# (which is standard python behavior). This is necessary so that the imports
33+
# refer to the checked out (and potentially modified) code.
34+
poetry run python -m pytest tests
35+
36+
poetry run sh ${SCRIPTS_BASEDIR}/tiff_cubing.sh
37+
poetry run sh ${SCRIPTS_BASEDIR}/meta_generation.sh
38+
poetry run sh ${SCRIPTS_BASEDIR}/downsampling.sh
39+
poetry run sh ${SCRIPTS_BASEDIR}/upsampling.sh
40+
rm -r $OUTPUT_PATH/tiff_upsampling
41+
rm -r testdata/tiff_mag_2_reference
42+
43+
poetry run sh ${SCRIPTS_BASEDIR}/anisotropic_downsampling.sh
44+
poetry run sh ${SCRIPTS_BASEDIR}/compression_and_verification.sh
45+
rm -r $OUTPUT_PATH/tiff_compress
46+
rm -r $OUTPUT_PATH/tiff_compress_broken
47+
48+
poetry run sh ${SCRIPTS_BASEDIR}/in_place_compression.sh
49+
rm -r $OUTPUT_PATH/tiff_compress2
50+
rm -r $OUTPUT_PATH/tiff_compress2.bak
51+
rm -r $OUTPUT_PATH/tiff
52+
53+
poetry run sh ${SCRIPTS_BASEDIR}/tile_cubing.sh
54+
rm -r $OUTPUT_PATH/temca2
55+
56+
poetry run sh ${SCRIPTS_BASEDIR}/simple_tiff_cubing.sh
57+
rm -r $OUTPUT_PATH/tiff2
58+
59+
poetry run sh ${SCRIPTS_BASEDIR}/simple_tiff_cubing_no_compression.sh
60+
rm -r $OUTPUT_PATH/tiff3
61+
62+
poetry run sh ${SCRIPTS_BASEDIR}/tiff_formats_cubing.sh
63+
rm -r $OUTPUT_PATH/tiff4
64+
65+
poetry run sh ${SCRIPTS_BASEDIR}/knossos_conversion.sh
66+
rm -r $OUTPUT_PATH/knossos
67+
68+
poetry run sh ${SCRIPTS_BASEDIR}/convert_raw.sh
69+
rm -r $OUTPUT_PATH/raw
70+
71+
rm -r $OUTPUT_PATH

wkcuber/tests/scripts/all_tests.sh

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)