From ed1c14788a95347604a276fcb698d3a8c3bd4563 Mon Sep 17 00:00:00 2001 From: arnaudbore Date: Thu, 12 Dec 2024 11:23:42 -0500 Subject: [PATCH 1/3] update tests --- .github/workflows/test.yml | 2 +- requirements.txt | 1 + scripts/tests/test_aodf_metrics.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 42c99cb2f..b82bfc521 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -56,7 +56,7 @@ jobs: - name: Run tests run: | export C_INCLUDE_PATH=$pythonLocation/include/python${{ steps.python-selector.outputs.python-version }}:$C_INCLUDE_PATH - pytest --cov-report term-missing:skip-covered + pytest -n logical --cov-report term-missing:skip-covered - name: Save test results and coverage uses: actions/upload-artifact@v4 diff --git a/requirements.txt b/requirements.txt index d946292e5..d98e95929 100644 --- a/requirements.txt +++ b/requirements.txt @@ -35,6 +35,7 @@ pybids==0.16.* pyparsing==3.0.* PySocks==1.7.* pytest==7.2.* +pytest-xdist==3.6.* pytest-console-scripts==1.3.* pytest-cov==4.1.0 pytest-html==4.1.1 diff --git a/scripts/tests/test_aodf_metrics.py b/scripts/tests/test_aodf_metrics.py index a242e060b..5e974b926 100644 --- a/scripts/tests/test_aodf_metrics.py +++ b/scripts/tests/test_aodf_metrics.py @@ -73,5 +73,5 @@ def test_execution_symmetric_input(script_runner, monkeypatch): ret = script_runner.run('scil_aodf_metrics.py', in_fodf, '--sphere', 'repulsion100', '--not_all', '--nufid', 'nufid.nii.gz', - '--processes', '4') + '--processes', '2') assert not ret.success From c25fcd895675d048afe80203143dff474b481472 Mon Sep 17 00:00:00 2001 From: arnaudbore Date: Thu, 12 Dec 2024 11:27:44 -0500 Subject: [PATCH 2/3] use only one process --- scripts/tests/test_aodf_metrics.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/tests/test_aodf_metrics.py b/scripts/tests/test_aodf_metrics.py index 5e974b926..54a94655d 100644 --- a/scripts/tests/test_aodf_metrics.py +++ b/scripts/tests/test_aodf_metrics.py @@ -73,5 +73,5 @@ def test_execution_symmetric_input(script_runner, monkeypatch): ret = script_runner.run('scil_aodf_metrics.py', in_fodf, '--sphere', 'repulsion100', '--not_all', '--nufid', 'nufid.nii.gz', - '--processes', '2') + '--processes', '1') assert not ret.success From 3db7caa8de4412082681db93c1ab283825cc0b1f Mon Sep 17 00:00:00 2001 From: arnaudbore Date: Thu, 12 Dec 2024 13:20:14 -0500 Subject: [PATCH 3/3] chmod scripts + update config for parallel test --- .github/workflows/test.yml | 2 +- pytest.ini | 1 + requirements.txt | 1 + scilpy/tractograms/tests/test_streamline_and_mask_operations.py | 2 +- scripts/scil_connectivity_compute_simple_matrix.py | 0 scripts/scil_fibertube_score_tractogram.py | 0 scripts/scil_fibertube_tracking.py | 0 scripts/scil_tractogram_filter_collisions.py | 0 scripts/scil_viz_tractogram_collisions.py | 0 9 files changed, 4 insertions(+), 2 deletions(-) mode change 100644 => 100755 scripts/scil_connectivity_compute_simple_matrix.py mode change 100644 => 100755 scripts/scil_fibertube_score_tractogram.py mode change 100644 => 100755 scripts/scil_fibertube_tracking.py mode change 100644 => 100755 scripts/scil_tractogram_filter_collisions.py mode change 100644 => 100755 scripts/scil_viz_tractogram_collisions.py diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b82bfc521..f659600a8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -56,7 +56,7 @@ jobs: - name: Run tests run: | export C_INCLUDE_PATH=$pythonLocation/include/python${{ steps.python-selector.outputs.python-version }}:$C_INCLUDE_PATH - pytest -n logical --cov-report term-missing:skip-covered + pytest -n logical --dist worksteal --cov-report term-missing:skip-covered - name: Save test results and coverage uses: actions/upload-artifact@v4 diff --git a/pytest.ini b/pytest.ini index 6983f0058..0dec21a22 100644 --- a/pytest.ini +++ b/pytest.ini @@ -28,6 +28,7 @@ required_plugins = pytest-mock pytest-html pytest-cov + pytest-xdist junit_logging = out-err diff --git a/requirements.txt b/requirements.txt index d98e95929..cf376d3c8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -36,6 +36,7 @@ pyparsing==3.0.* PySocks==1.7.* pytest==7.2.* pytest-xdist==3.6.* +pytest-xdist[psutil]==3.6.* pytest-console-scripts==1.3.* pytest-cov==4.1.0 pytest-html==4.1.1 diff --git a/scilpy/tractograms/tests/test_streamline_and_mask_operations.py b/scilpy/tractograms/tests/test_streamline_and_mask_operations.py index 772c41a6a..6127a586a 100644 --- a/scilpy/tractograms/tests/test_streamline_and_mask_operations.py +++ b/scilpy/tractograms/tests/test_streamline_and_mask_operations.py @@ -92,7 +92,7 @@ def test_get_endpoints_density_map_five_points(): result = nib.load(in_result).get_fdata() - assert np.allclose(endpoints_map, result) + assert np.allclose(endpoints_map, result, rtol=1e-03) def test_get_head_tail_density_maps(): diff --git a/scripts/scil_connectivity_compute_simple_matrix.py b/scripts/scil_connectivity_compute_simple_matrix.py old mode 100644 new mode 100755 diff --git a/scripts/scil_fibertube_score_tractogram.py b/scripts/scil_fibertube_score_tractogram.py old mode 100644 new mode 100755 diff --git a/scripts/scil_fibertube_tracking.py b/scripts/scil_fibertube_tracking.py old mode 100644 new mode 100755 diff --git a/scripts/scil_tractogram_filter_collisions.py b/scripts/scil_tractogram_filter_collisions.py old mode 100644 new mode 100755 diff --git a/scripts/scil_viz_tractogram_collisions.py b/scripts/scil_viz_tractogram_collisions.py old mode 100644 new mode 100755