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] run test and flake8 github actions #131

Merged
merged 33 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
d59d9ba
install all other dependencies
Remi-Gau Aug 30, 2023
42d3f4d
improve tests
Remi-Gau Aug 30, 2023
1d32598
improve install in ci
Remi-Gau Aug 30, 2023
3c735de
add coveralls
Remi-Gau Aug 30, 2023
f97fb3d
update args
Remi-Gau Aug 30, 2023
4061ca4
start with old python versions
Remi-Gau Aug 30, 2023
7702dd6
use latest scikit image
Remi-Gau Aug 30, 2023
a15e995
skip coverage for now
Remi-Gau Aug 30, 2023
ca5088d
install nbval later
Remi-Gau Aug 30, 2023
4d24e31
verbose
Remi-Gau Aug 30, 2023
10ba6ee
skip test before cancel run
Remi-Gau Aug 30, 2023
20b3c44
skip test
Remi-Gau Aug 30, 2023
0d7d595
add GHA for flake8
Remi-Gau Aug 30, 2023
b02080e
skip more tests
Remi-Gau Aug 30, 2023
b0ee188
fix flake8
Remi-Gau Aug 30, 2023
3077855
check each atlas
Remi-Gau Aug 30, 2023
4fc4417
unskip
Remi-Gau Aug 30, 2023
eba9d63
try another
Remi-Gau Aug 30, 2023
b147329
Merge branch 'flake8' into tests
Remi-Gau Aug 30, 2023
25bbee9
flake8
Remi-Gau Aug 30, 2023
818307d
split tests
Remi-Gau Aug 31, 2023
6bfa6b2
add pre commit for flake8 and rm travis
Remi-Gau Aug 31, 2023
a84aba8
split tests
Remi-Gau Aug 31, 2023
198f9cf
drop python 3.7
Remi-Gau Aug 31, 2023
f198845
fix tests
Remi-Gau Aug 31, 2023
7d78c72
fix test
Remi-Gau Aug 31, 2023
272d4fa
rm unused imports
Remi-Gau Aug 31, 2023
a411899
Adds minimal package versions to requirements
Oct 14, 2023
f6bdcc3
Corrects shape bug in labels file
Oct 14, 2023
9938e77
Adds coveralls badge to readme
Oct 14, 2023
a4ea91a
Updates faulty batches
Oct 14, 2023
413528e
fix cover all
Remi-Gau Oct 16, 2023
e272e4c
add setup tools
Remi-Gau Oct 16, 2023
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
10 changes: 7 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']

runs-on: ubuntu-latest

Expand All @@ -35,16 +35,20 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
python -m pip install --upgrade pip pytest jupyter nbval
python -m pip install --upgrade pip pytest pytest-cov

- name: Install
run: pip install .

- name: Test
run: pytest --cov-report term-missing --cov=atlasreader
run: pytest -vvv atlasreader

- name: Coveralls
uses: coverallsapp/github-action@v2

- name: Test notebooks
run: |
pip install nbval
for n in `ls notebooks/*ipynb`
do
pytest --nbval-lax -v -s ${n};
Expand Down
2 changes: 1 addition & 1 deletion atlasreader/atlasreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def get_subpeak_coords(clust_img, min_distance=20):
data = check_niimg(clust_img).get_fdata()

# find local maxima, excluding peaks that are on the border of the cluster
local_max = peak_local_max(data, exclude_border=1, indices=False)
local_max = peak_local_max(data, exclude_border=1)
miykael marked this conversation as resolved.
Show resolved Hide resolved

# make new clusters to check for "flat" peaks + find CoM of those clusters
labels, nl = label(local_max)
Expand Down
3 changes: 2 additions & 1 deletion atlasreader/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@

TESTS_REQUIRE = [
'pytest',
'pytest-cov'
'pytest-cov',
'nbval'
]

PACKAGE_DATA = {
Expand Down
13 changes: 9 additions & 4 deletions atlasreader/tests/test_atlasreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
[-36, -19, 19, -6.21808, 648]])
)

@pytest.mark.parametrize('atlas', atlasreader._ATLASES)
def test_check_atlases_each(atlas):
atlasreader.check_atlases(atlas)

def test_get_atlases():
for atlas in atlasreader._ATLASES:
Expand All @@ -64,12 +67,15 @@ def test_get_atlases():
with pytest.raises(ValueError):
atlasreader.get_atlas('not_an_atlas')


def test_check_atlases():
def test_check_atlases_all():
miykael marked this conversation as resolved.
Show resolved Hide resolved
atlases = atlasreader.check_atlases('all')
assert len(atlases) == len(atlasreader._ATLASES)

def test_check_atlases_default():
atlases = atlasreader.check_atlases('default')
assert len(atlases) == len(atlasreader._DEFAULT)

def test_check_atlases_default():
atlases = atlasreader.check_atlases(['aal', 'destrieux'])
assert atlasreader.check_atlases(atlases) == atlases
assert atlasreader.check_atlases(atlases[0]) == atlases[0]
Expand Down Expand Up @@ -113,8 +119,7 @@ def test_get_statmap_info():
assert len(cdf) == 0
assert len(pdf) == 0


def test_read_atlas_preaks():
def test_read_atlas_peaks():
# Load a correct atlas
atlasreader.read_atlas_peak('aal', [10, 10, 10])
# Load a list of atlases
Expand Down
3 changes: 3 additions & 0 deletions notebooks/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.png
*.csv
*.nii.gz
Loading