Skip to content

Broken: tests/coops_test.py::test_coops_data_products_w_date_input[7-cb1101-currents] #168

@pmav99

Description

@pmav99

The test of the title is broken.

This is what is causing the failure of CI/CD too.

https://github.com/oceanmodeling/searvey/blob/4d23de7bd5a9ffe363f5d299e96a5a3bce6bc8ed/.github/workflows/install_from_pypi.yml
https://github.com/oceanmodeling/searvey/actions/runs/11046019490/job/30684650806

ERROR    searvey._coops_api:_coops_api.py:262 cb1101: Encountered an error response for {'station_id': 'cb1101', 'url': URL('https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?station=cb1101&product=currents&datum=MSL&units=metric&time_zone=gmt&format=json&application=oceanmodeling%2Fstormevents&begin_date=20240919%2005%3A17&end_date=20240926%2005%3A17'), 'client': <httpx.Client object at 0x7f99a7a70b60>, 'rate_limit': <multifutures._rate_limit.RateLimit object at 0x7f99a7a70f20>, 'product': <COOPS_Product.CURRENTS: 'currents'>, 'redirect': True}!
ERROR    searvey._coops_api:_coops_api.py:263 --> No data was found. This product may not be offered at this station at the requested time.
WARNING  searvey._coops_api:_coops_api.py:390 COOPS-cb1101: No data. Creating a dummy dataframe
=========================== short test summary info ============================
FAILED tests/coops_test.py::test_coops_data_products_w_date_input[7-cb1101-currents] - TypeError: Invalid comparison between dtype=datetime64[ns] and Timestamp
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!

The problem is that the test is written in a way that tries to retrieve the last N days of data since the current day. This is fragile because if a station gets offline or something then we might not get any data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions