Skip to content

Commit

Permalink
Merge pull request #29 from haessar/feature-macos
Browse files Browse the repository at this point in the history
macOS compatibility
  • Loading branch information
haessar authored Jan 15, 2024
2 parents 530172a + dccc4f2 commit e8fae87
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 5 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,29 @@ 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
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Cache APT Packages
- name: Cache APT Packages (Linux)
uses: awalsh128/[email protected]
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
Expand Down
3 changes: 2 additions & 1 deletion peaks2utr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = peaks2utr
version = 1.2.2
version = 1.2.3
author = William Haese-Hill
author_email = [email protected]
description = A robust, parallelized Python CLI for annotating three_prime_UTR
Expand Down
25 changes: 25 additions & 0 deletions tests/test_entrypoint.py
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit e8fae87

Please sign in to comment.