Skip to content

Commit dbd9210

Browse files
committed
Run tests in parallel when possible
1 parent 9b5bfa2 commit dbd9210

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

.github/workflows/python-package.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
3232
pip install .
3333
34-
pip install cython flake8 pytest
34+
pip install cython flake8 pytest pytest-xdist
3535
- name: Lint with flake8
3636
run: |
3737
source env/bin/activate
@@ -42,4 +42,4 @@ jobs:
4242
- name: Test with pytest
4343
run: |
4444
source env/bin/activate
45-
pytest tests/
45+
pytest -n auto -m "not serial" tests/ && pytest -m "serial" tests/

tests/pytest.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[pytest]
2+
markers =
3+
serial: mark test that should be run serially

tests/test_parallel_leiden_performance.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import igraph as ig
1010
import numpy as np
1111
import psutil
12+
import pytest
1213
import unittest
1314
import warnings
1415

@@ -59,6 +60,7 @@ def determine_target_parallelization_speedup(num_calculations=32):
5960
return num_pool_calculations / num_calculations * base_duration / pool_duration
6061

6162

63+
@pytest.mark.serial # these tests have to run serially for the parallel performance comparisons to make sense
6264
class TestParallelLeidenPerformance(unittest.TestCase):
6365
@staticmethod
6466
def run_singlelayer_graph_parallelization(G, gammas):

0 commit comments

Comments
 (0)