Skip to content

Commit

Permalink
Merge pull request #1352 from ocefpaf/inspect_deprecation_warnings
Browse files Browse the repository at this point in the history
Inspect deprecation warnings
  • Loading branch information
jswhit authored Jul 22, 2024
2 parents 84e3dd5 + d6b4f03 commit 7c61f6e
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/miniconda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- name: Tests
run: |
cd test && python run_all.py
pytest -s -rxs -v test
run-mpi:
runs-on: ${{ matrix.os }}
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ where = ["src"]

[tool.pytest.ini_options]
pythonpath = ["test"]
filterwarnings = [
"error",
"ignore::UserWarning",
]

[tool.mypy]
files = ["src/netCDF4"]
Expand Down
2 changes: 1 addition & 1 deletion src/netCDF4/_netCDF4.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -5315,7 +5315,7 @@ rename a `Variable` attribute named `oldname` to `newname`."""
# corresponds to missing values, don't fill masked array -
# just use underlying data instead
if hasattr(self, 'missing_value') and \
numpy.all(numpy.in1d(data.data[data.mask],self.missing_value)):
numpy.all(numpy.isin(data.data[data.mask],self.missing_value)):
data = data.data
else:
if hasattr(self, 'missing_value'):
Expand Down
2 changes: 1 addition & 1 deletion test/test_dap.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

# test accessing data over http with opendap.

yesterday = datetime.utcnow() - timedelta(days=1)
yesterday = datetime.now() - timedelta(days=1)
URL = f'http://nomads.ncep.noaa.gov/dods/gfs_1p00/gfs{yesterday:%Y%m%d}/gfs_1p00_00z'
URL_https = 'https://www.neracoos.org/erddap/griddap/WW3_EastCoast_latest'
varname = 'hgtsfc'
Expand Down
2 changes: 1 addition & 1 deletion test/test_stringarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def setUp(self):
v2[:-1] = data[:-1]
v2[-1] = data[-1]
v2[-1,-1] = data[-1,-1] # write single element
v2[-1,-1] = data[-1,-1].tostring() # write single python string
v2[-1,-1] = data[-1,-1].tobytes() # write single python string
# _Encoding should be ignored if an array of characters is specified
v3[:] = stringtochar(data, encoding='ascii')
nc.close()
Expand Down
2 changes: 1 addition & 1 deletion test/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def runTest(self):
#assert np.allclose(datarr, ranarr[1:n1dim].astype(data.dtype))
assert_array_almost_equal(datarr,ranarr[1:n1dim].astype(data.dtype))
else:
assert datarr.tostring() == ranarr[1:n1dim].astype(data.dtype).tostring()
assert datarr.tobytes() == ranarr[1:n1dim].astype(data.dtype).tobytes()
# check that variable elements not yet written are filled
# with the specified _FillValue.
assert_array_equal(datfilled,np.asarray(data._FillValue,datfilled.dtype))
Expand Down

0 comments on commit 7c61f6e

Please sign in to comment.