Skip to content

Commit

Permalink
Test without numpy and other optional dependencies (#2)
Browse files Browse the repository at this point in the history
* Test without numpy and other optional dependencies

* importorskip stuffs
  • Loading branch information
hmaarrfk authored Sep 18, 2024
1 parent 491fea4 commit 036c0ed
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ jobs:
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
include:
- python-version: 3.10
with-numpy: true
- python-version: 3.11
with-numpy: false
- python-version: 3.12
with-numpy: true
max-parallel: 8
fail-fast: false

Expand All @@ -37,7 +44,10 @@ jobs:
run: |
export RO_JSON_GIT_DESCRIBE=${{ steps.ghd.outputs.describe }}
python -m pip install --upgrade pip
pip install setuptools pytest pytz pathlib numpy pandas
pip install setuptools pytest pathlib
if [ "${{ matrix.with-numpy }}" = "true" ]; then
pip install pytz numpy pandas
fi
- name: Install package
run: |
Expand All @@ -48,4 +58,5 @@ jobs:
run: |
export RO_JSON_GIT_DESCRIBE=${{ steps.ghd.outputs.describe }}
python --version
pip check
pytest -v --strict
4 changes: 4 additions & 0 deletions tests/test_np.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
from _pytest.recwarn import warns
from datetime import datetime, timezone

import pytest

pytest.importorskip('numpy')

from numpy import arange, ones, array, array_equal, finfo, iinfo, pi
from numpy import int8, int16, int32, int64, uint8, uint16, uint32, uint64, \
float16, float32, float64, complex64, complex128, zeros, ndindex, \
Expand Down
8 changes: 5 additions & 3 deletions tests/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
# -*- coding: utf-8 -*-

from collections import OrderedDict
from ro_json import dumps, loads
from tests.test_bare import nonpdata
import pytest
pytest.importorskip('pandas')
pytest.importorskip('numpy')
from numpy import linspace, isnan
from numpy.testing import assert_equal
from pandas import DataFrame, Series
from ro_json import dumps, loads
from tests.test_bare import nonpdata


COLUMNS = OrderedDict((
('name', ('Alfa', 'Bravo', 'Charlie', 'Delta', 'Echo', 'Foxtrot', 'Golf',
Expand Down
2 changes: 2 additions & 0 deletions tests/test_tz.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
from datetime import datetime, date, time, timedelta, timezone
from ro_json import dumps, loads
from ro_json.utils import is_py3
import pytest
pytest.importorskip('pytz')
import pytz


Expand Down

0 comments on commit 036c0ed

Please sign in to comment.