Skip to content

Commit

Permalink
mp fix for macOS and (maybe) Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
francoislaurent committed Mar 30, 2021
1 parent 086c903 commit 480316c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Unit tests and code coverage

Expand All @@ -20,7 +18,8 @@ jobs:
#- ubuntu-latest
- macos-latest
#- windows-latest
python-version: [3.6, 3.7, 3.8, 3.9]
#python-version: [3.6, 3.7, 3.8, 3.9]
python-version: [3.8]
fail-fast: true

steps:
Expand Down Expand Up @@ -51,11 +50,12 @@ jobs:
- name: Install HDF5 (macOS)
if: ${{ runner.os == 'macOS' }}
run: |
brew update
brew install hdf5
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest
python -m pip install pytest, pathos
python -m pip install .[roi]
- name: Test with pytest (Windows)
if: ${{ runner.os == 'Windows' }}
Expand All @@ -67,6 +67,10 @@ jobs:
tests/test_analyzer.py::TestIndexer
tests/test_analyzer.py::TestAssignment
tests/test_analyzer.py::TestSideEffects
- name: Test with pytest (macOS)
if: ${{ runner.os == 'macOS' }}
run: >-
pytest tests/test_analyzer.py::TestMapper::test_time_regul
- name: Test with pytest (Linux and macOS)
if: ${{ runner.os != 'Windows' }}
run: >-
Expand Down Expand Up @@ -94,5 +98,5 @@ jobs:
tests/test_core.py \
tests/test_analyzer.py
- uses: codecov/codecov-action@v1
#with:
# fail_ci_if_error: true
with:
fail_ci_if_error: true
8 changes: 6 additions & 2 deletions tramway/core/parallel/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

# Copyright © 2019, Institut Pasteur
# Copyright © 2019-2021, Institut Pasteur
# Contributor: François Laurent

# This file is part of the TRamWAy software available at
Expand All @@ -12,7 +12,11 @@
# knowledge of the CeCILL license and that you accept its terms.


import multiprocessing
import sys
if sys.platform.startswith('linux'):
import multiprocessing
else:
import pathos.multiprocessing as multiprocessing
try:
import queue
except ImportError:
Expand Down
10 changes: 8 additions & 2 deletions tramway/inference/base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

# Copyright © 2017-2019, Institut Pasteur
# Copyright © 2017-2021, Institut Pasteur
# Contributor: François Laurent

# This file is part of the TRamWAy software available at
Expand All @@ -23,7 +23,13 @@
import scipy.spatial.qhull
from copy import copy
from collections import OrderedDict
from multiprocessing import Pool, Lock

import sys
if sys.platform.startswith('linux'):
from multiprocessing import Pool, Lock
else:
from pathos.multiprocessing import Pool, Lock

import os # for os.name
import six
from functools import partial
Expand Down

0 comments on commit 480316c

Please sign in to comment.