Skip to content

Commit

Permalink
Handle some warnings (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
crusaderky committed Jan 28, 2024
1 parent 9dc3c18 commit 7052021
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ universal = 1
universal = 1

[tool:pytest]
addopts = --strict
addopts = --strict-markers --strict-config -v -r sxfE --color=yes
xfail_strict = true
python_files = test_*.py
testpaths = xarray_extras/tests

Expand Down
6 changes: 4 additions & 2 deletions xarray_extras/kernels/np_to_csv_py.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
from __future__ import annotations

import ctypes
import warnings

import numpy as np

from xarray_extras.kernels import np_to_csv # type: ignore

np_to_csv = np.ctypeslib.load_library("np_to_csv", np_to_csv.__file__)

with warnings.catch_warnings():
warnings.simplefilter("ignore", category=DeprecationWarning)
np_to_csv = np.ctypeslib.load_library("np_to_csv", np_to_csv.__file__)

np_to_csv.snprintcsvd.argtypes = [
ctypes.c_char_p, # char * buf
Expand Down
4 changes: 2 additions & 2 deletions xarray_extras/tests/test_cumulatives.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
dims=["t", "s"],
coords={
"t": numpy.array(
["1990-12-30", "2000-12-30", "2005-12-30", "2010-12-30"], dtype="<M8[D]"
["1990-12-30", "2000-12-30", "2005-12-30", "2010-12-30"], dtype="M8[ns]"
),
"s": ["s1", "s2", "s3"],
},
Expand All @@ -26,7 +26,7 @@
["2000-12-30", "1990-12-30", "NaT"],
["2010-12-30", "1990-12-30", "2005-12-30"],
],
dtype="<M8[D]",
dtype="M8[ns]",
),
dims=["t2", "c"],
coords={"t2": [10, 20, 30, 40]},
Expand Down
1 change: 1 addition & 0 deletions xarray_extras/tests/test_interpolate.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ def test_nonfloat(x_dtype, x_new_dtype):
assert_equal(expect, y_new)


@pytest.mark.filterwarnings("ignore:Converting non-nanosecond precision datetime ")
@pytest.mark.parametrize("x_new_dtype", ["<M8[D]", "<M8[s]", "<M8[ns]"])
@pytest.mark.parametrize("x_dtype", ["<M8[D]", "<M8[s]", "<M8[ns]"])
def test_dates(x_dtype, x_new_dtype):
Expand Down

0 comments on commit 7052021

Please sign in to comment.