Skip to content

Commit

Permalink
Adds Flake8, Mypy and unittest exection workflow for Github.
Browse files Browse the repository at this point in the history
Signed-off-by: raf-be <[email protected]>
  • Loading branch information
rafa-be committed Aug 26, 2024
1 parent db3eaa1 commit 4c42dfa
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
41 changes: 41 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python Linter And Unittest

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Install dependencies
# TODO: add Scaler as a test dependency once it's published to Pypi
run: |
python -m pip install --upgrade pip
pip install flake8 pyproject-flake8 mypy
pip install -r requirements.txt
pip install pandas dask distributed
- name: Lint with flake8
run: |
pflake8 .
- name: Lint with MyPy
run: |
mypy .
- name: Run python unittest
run: |
python -m unittest discover -v tests
5 changes: 4 additions & 1 deletion tests/test_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
from parfun.combine.collection import list_concat
from parfun.combine.dataframe import df_concat
from parfun.decorators import parfun
from parfun.entry_point import get_parallel_backend, set_parallel_backend, set_parallel_backend_context
from parfun.entry_point import (
BACKEND_REGISTRY, get_parallel_backend, set_parallel_backend, set_parallel_backend_context
)
from parfun.partition.api import per_argument
from parfun.partition.collection import list_by_chunk
from parfun.partition.dataframe import df_by_row
Expand Down Expand Up @@ -101,6 +103,7 @@ def test_parallel_concurrent_generator(self):
self.assertGreater(duration, expected_duration)
self.assertAlmostEqual(duration, expected_duration, delta=expected_duration * 0.2) # within 20% of expected

@unittest.skipUnless("scaler_local" in BACKEND_REGISTRY, "Scaler backend not installed")
def test_parallel_nested_calls(self):
"""Makes sure that the decorators handles nested parallel function calls."""

Expand Down

0 comments on commit 4c42dfa

Please sign in to comment.