Skip to content

Commit

Permalink
Suppress xarray warning in test suite (#179)
Browse files Browse the repository at this point in the history
- Importing `xarray.tests` sets `warn_for_unclosed_files` to True
- Must import utilities from `xarray.tests` `__init__.py` to avoid `warn_for_unclosed_files` to be reset back to True
  • Loading branch information
tomvothecoder authored Dec 22, 2021
1 parent c789bae commit 85786c5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit test package for xcdat."""
from xarray.core.options import set_options
from xarray.tests import requires_dask # noqa: F401

set_options(warn_for_unclosed_files=False)
2 changes: 1 addition & 1 deletion tests/test_spatial_avg.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import numpy as np
import pytest
import xarray as xr
from xarray.tests import requires_dask

from tests import requires_dask
from tests.fixtures import generate_dataset
from xcdat.spatial_avg import SpatialAverageAccessor

Expand Down

0 comments on commit 85786c5

Please sign in to comment.