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

[MAINT] use tox to install test data #73

Merged
merged 1 commit into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 4 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
- name: install tox
run: pip install tox
- uses: actions/cache@v3
id: cache
env:
Expand All @@ -54,19 +57,7 @@ jobs:
- if: ${{ steps.cache.outputs.cache-hit != 'true' }}
name: Download fmriprep derivative of ds000017
id: download
run: |
mkdir -p /home/runner/work/giga_connectome/giga_connectome/giga_connectome/data/test_data
cd /home/runner/work/giga_connectome/giga_connectome/giga_connectome/data/test_data
wget --retry-connrefused \
--waitretry=5 \
--read-timeout=20 \
--timeout=15 \
-t 0 \
-q \
-O ds000017.tar.gz \
"https://zenodo.org/record/8091903/files/ds000017-fmriprep22.0.1-downsampled-nosurface.tar.gz?download=1"
tar -xzf ds000017.tar.gz
rm ds000017.tar.gz
run: tox -e test_data

build:
runs-on: ubuntu-latest
Expand Down
10 changes: 9 additions & 1 deletion docs/source/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ pip install -e .[dev]
pre-commit install
```

5. Install the data required for testing from zenodo

This can be done using tox by running:

```bash
tox -e test_data
```

## Contributing to code

This is a very generic workflow.
Expand All @@ -51,7 +59,7 @@ git checkout -b your_branch
5. Run the tests locally; you can run spectfic tests to speed up the process:

```bash
pytest -v giga_connectome/tests/tests/test_connectome.py::test_calculate_intranetwork_correlation
pytest -v giga_connectome/tests/test_connectome.py::test_calculate_intranetwork_correlation
```

6. push your changes to your online fork. If this is the first commit, you might want to set up the remote tracking:
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ dev = [
"black",
"pre-commit",
"giga_connectome[test]",
'tox',
]
test = [
"pytest",
Expand Down
45 changes: 45 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
; See https://tox.wiki/en
[tox]
requires =
tox>=4
; run lint by default when just calling "tox"
env_list = lint

; ENVIRONMENTS
; ------------
[style]
description = common environment for style checkers (rely on pre-commit hooks)
skip_install = true
deps =
pre-commit

; COMMANDS
; --------
[testenv:lint]
description = run all linters and formatters
skip_install = true
deps =
{[style]deps}
commands =
pre-commit run --all-files --show-diff-on-failure {posargs:}

[testenv:test_data]
description = install test data
skip_install = true
allowlist_externals =
mkdir
wget
tar
rm
commands =
mkdir -p giga_connectome/data/test_data
wget --retry-connrefused \
--waitretry=5 \
--read-timeout=20 \
--timeout=15 \
-t 0 \
-q \
-O giga_connectome/data/test_data/ds000017.tar.gz \
"https://zenodo.org/record/8091903/files/ds000017-fmriprep22.0.1-downsampled-nosurface.tar.gz?download=1"
tar -xzf giga_connectome/data/test_data/ds000017.tar.gz -C giga_connectome/data/test_data/
rm giga_connectome/data/test_data/ds000017.tar.gz
Loading