diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a190ad1..c0b6243 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,11 +12,12 @@ on: jobs: build: - runs-on: ubuntu-latest strategy: fail-fast: false matrix: python-version: ["3.8", "3.9", "3.10", "3.11"] + os: [ubuntu-latest, macos-latest] + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 @@ -24,12 +25,16 @@ jobs: uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} - - name: Cache APT Packages + - name: Cache APT Packages (Linux) uses: awalsh128/cache-apt-pkgs-action@v1.3.0 with: packages: bedtools genometools version: 1.0 - - name: Install dependencies + if: matrix.os == 'ubuntu-latest' + - name: Install dependencies (macOS) + run: brew install bedtools genometools + if: matrix.os == 'macos-latest' + - name: Install Python dependencies run: | python -m pip install --upgrade pip python -m pip install flake8 pytest diff --git a/peaks2utr/__init__.py b/peaks2utr/__init__.py index 9e46eda..566ea7b 100644 --- a/peaks2utr/__init__.py +++ b/peaks2utr/__init__.py @@ -78,7 +78,8 @@ def main(): from .constants import PERC_ALLOCATED_VRAM from .utils import limit_memory - limit_memory(PERC_ALLOCATED_VRAM * virtual_memory().total / 100) + if platform != "darwin": + limit_memory(PERC_ALLOCATED_VRAM * virtual_memory().total / 100) argparser = prepare_argparser() args = argparser.parse_args() asyncio.run(_main(args)) diff --git a/setup.cfg b/setup.cfg index d9e232b..4557dc1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = peaks2utr -version = 1.2.2 +version = 1.2.3 author = William Haese-Hill author_email = william.haese-hill@glasgow.ac.uk description = A robust, parallelized Python CLI for annotating three_prime_UTR diff --git a/tests/test_entrypoint.py b/tests/test_entrypoint.py new file mode 100644 index 0000000..ede5bc6 --- /dev/null +++ b/tests/test_entrypoint.py @@ -0,0 +1,25 @@ +import multiprocessing +from sys import platform +import unittest +from unittest.mock import patch + +from peaks2utr import main + + +class TestEntryPoint(unittest.TestCase): + def test_main(self): + with patch('asyncio.run') as mock_run: + with patch('peaks2utr.prepare_argparser') as mock_argparser: + with patch('peaks2utr.utils.limit_memory') as mock_limit_memory: + main() + self.assertEqual(mock_run.call_count, 1) + self.assertEqual(mock_argparser.call_count, 1) + self.assertEqual(multiprocessing.get_start_method(), 'fork') + if platform == "darwin": + self.assertEqual(mock_limit_memory.call_count, 0) + else: + self.assertEqual(mock_limit_memory.call_count, 1) + + +if __name__ == '__main__': + unittest.main()