Skip to content

Commit

Permalink
Added additional tests of jit and njit with kwargs.
Browse files Browse the repository at this point in the history
  • Loading branch information
johannvk committed Nov 18, 2024
1 parent 43e1ce7 commit 0af9dac
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 37 deletions.
39 changes: 2 additions & 37 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
python -m pip install --upgrade pip
python -m pip install .[dev]
python -m pip install pytest
- name: Test with pytest - without Numba
- name: Run pytest - without Numba installed
run: |
pytest --cov --cov-report=xml
- name: Install Skchange + Numba
Expand All @@ -45,45 +45,10 @@ jobs:
- name: Disable numba JIT
run: |
echo "NUMBA_DISABLE_JIT=1" >> $GITHUB_ENV
- name: Test with pytest
- name: Run pytest - with Numba installed
run: |
pytest --cov --cov-report=xml --cov-append
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

# pytests-no-numba:
# name: Run pytests without numba
# needs: pytests-numba
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Set up Python
# uses: actions/setup-python@v4
# with:
# python-version: "3.9"
# - name: Install Python dependencies
# run: |
# python -m pip install --upgrade pip
# python -m pip install .[dev]
# python -m pip install pytest
# - name: Test with pytest
# run: |
# pytest --cov --cov-report=xml --cov-append

# upload-code-cov:
# name: Upload-coverage-reports-to-Codecov
# needs: [pytests-numba, pytests-no-numba]
# runs-on: ubuntu-latest
# steps:
# - name: Check for coverage report files
# run: |
# if [ ! -f coverage.xml ]; then
# echo "No coverage report found!"
# exit 1
# fi
# - name: Upload coverage reports to Codecov
# uses: codecov/codecov-action@v3
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
16 changes: 16 additions & 0 deletions skchange/utils/numba/tests/test_soft_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,22 @@ def multiply(a, b):
assert multiply(2, 3) == 6


def test_jit_function_with_args():
@jit(cache=True)
def multiply(a, b):
return a * b

assert multiply(2, 3) == 6


def test_njit_function_with_args():
@njit(cache=True)
def add(a, b):
return a + b

assert add(1, 2) == 3


def test_prange_function():
with temp_env_and_modules(
remove_module_prefix="skchange", env_vars={"NUMBA_DISABLE_JIT": "1"}
Expand Down

0 comments on commit 0af9dac

Please sign in to comment.