Skip to content

Commit

Permalink
add decorator to skip wradlib tests on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
neumann-nico committed Oct 2, 2021
1 parent 1da9c5f commit db0c181
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 19 deletions.
5 changes: 5 additions & 0 deletions tests/__init__.py
Expand Up @@ -10,3 +10,8 @@
mac_arm64_unsupported = pytest.mark.skipif(
mac_arm64, reason="can't be tested under mac arm64 due to h5py incompatibility"
)

windows = platform.system() == "Windows"
windows_unsupported = pytest.mark.skipif(
windows, reason="can't be tested under windows due to unsupported wradlib library"
)
35 changes: 24 additions & 11 deletions tests/provider/dwd/radar/test_api_historic.py
Expand Up @@ -10,7 +10,11 @@
import pybufrkit
import pytest
import requests
import wradlib as wrl

from tests import windows, windows_unsupported

if not windows:
import wradlib as wrl

from tests.provider.dwd.radar import station_reference_pattern_unsorted
from wetterdienst.provider.dwd.radar import (
Expand Down Expand Up @@ -207,6 +211,7 @@ def test_radar_request_composite_historic_fx_timerange():
)


@windows_unsupported
@pytest.mark.remote
def test_radar_request_composite_historic_radolan_rw_yesterday():
"""
Expand Down Expand Up @@ -266,8 +271,8 @@ def test_radar_request_composite_historic_radolan_rw_yesterday():
}
del requested_attrs["radolanversion"]

# radarlocations can change over time -> check if at least 10 radar locations were found
# and at least 5 of them match with the provided one
# radar locations can change over time -> check if at least 10 radar locations
# were found and at least 5 of them match with the provided one
assert len(requested_attrs["radarlocations"]) >= 10
assert (
len(list(set(requested_attrs["radarlocations"]) & set(attrs["radarlocations"])))
Expand All @@ -279,6 +284,7 @@ def test_radar_request_composite_historic_radolan_rw_yesterday():
assert requested_attrs == attrs


@windows_unsupported
@pytest.mark.remote
def test_radar_request_composite_historic_radolan_rw_timerange():
"""
Expand Down Expand Up @@ -345,8 +351,8 @@ def test_radar_request_composite_historic_radolan_rw_timerange():
del requested_attrs["datetime"]
del requested_attrs["radolanversion"]

# radarlocations can change over time -> check if at least 10 radar locations were found
# and at least 5 of them match with the provided one
# radar locations can change over time -> check if at least 10 radar locations
# were found and at least 5 of them match with the provided one
assert len(requested_attrs["radarlocations"]) >= 10
assert (
len(list(set(requested_attrs["radarlocations"]) & set(attrs["radarlocations"])))
Expand All @@ -358,6 +364,7 @@ def test_radar_request_composite_historic_radolan_rw_timerange():
assert requested_attrs == attrs


@windows_unsupported
@pytest.mark.remote
def test_radar_request_site_historic_dx_yesterday():
"""
Expand Down Expand Up @@ -408,6 +415,7 @@ def test_radar_request_site_historic_dx_yesterday():
assert requested_attrs == attrs


@windows_unsupported
@pytest.mark.remote
def test_radar_request_site_historic_dx_timerange():
"""
Expand Down Expand Up @@ -463,6 +471,7 @@ def test_radar_request_site_historic_dx_timerange():
assert requested_attrs == attrs


@windows_unsupported
@pytest.mark.remote
def test_radar_request_site_historic_pe_binary_yesterday():
"""
Expand Down Expand Up @@ -974,6 +983,7 @@ def test_radar_request_site_historic_sweep_vol_v_hdf5_timerange():
# TODO: Verify data.


@windows_unsupported
@pytest.mark.remote
def test_radar_request_radvor_re_yesterday():
"""
Expand Down Expand Up @@ -1037,12 +1047,13 @@ def test_radar_request_radvor_re_yesterday():
],
"predictiontime": 0,
"moduleflag": 8,
"quantification": 16,
# "quantification": 16,
}
del requested_attrs["radolanversion"]
del requested_attrs["quantification"]

# radarlocations can change over time -> check if at least 10 radar locations were found
# and at least 5 of them match with the provided one
# radar locations can change over time -> check if at least 10 radar locations
# were found and at least 5 of them match with the provided one
assert len(requested_attrs["radarlocations"]) >= 10
assert (
len(list(set(requested_attrs["radarlocations"]) & set(attrs["radarlocations"])))
Expand Down Expand Up @@ -1083,6 +1094,7 @@ def test_radar_request_radvor_re_timerange():
# TODO: Verify data.


@windows_unsupported
@pytest.mark.remote
def test_radar_request_radvor_rq_yesterday():
"""
Expand Down Expand Up @@ -1146,12 +1158,13 @@ def test_radar_request_radvor_rq_yesterday():
],
"predictiontime": 0,
"moduleflag": 8,
"quantification": 0,
# "quantification": 0,
}
del requested_attrs["radolanversion"]
del requested_attrs["quantification"]

# radarlocations can change over time -> check if at least 10 radar locations were found
# and at least 5 of them match with the provided one
# radar locations can change over time -> check if at least 10 radar locations
# were found and at least 5 of them match with the provided one
assert len(requested_attrs["radarlocations"]) >= 10
assert (
len(list(set(requested_attrs["radarlocations"]) & set(attrs["radarlocations"])))
Expand Down
12 changes: 9 additions & 3 deletions tests/provider/dwd/radar/test_api_latest.py
Expand Up @@ -5,7 +5,11 @@
from datetime import datetime

import pytest
import wradlib as wrl

from tests import windows, windows_unsupported

if not windows:
import wradlib as wrl

from tests.provider.dwd.radar import station_reference_pattern_unsorted
from wetterdienst.provider.dwd.radar import DwdRadarValues
Expand Down Expand Up @@ -38,6 +42,7 @@ def test_radar_request_composite_latest_rx_reflectivity():
assert re.match(bytes(header, encoding="ascii"), payload[:160])


@windows_unsupported
@pytest.mark.remote
def test_radar_request_composite_latest_rw_reflectivity():
"""
Expand Down Expand Up @@ -97,8 +102,8 @@ def test_radar_request_composite_latest_rw_reflectivity():
}
del requested_attrs["radolanversion"]

# radarlocations can change over time -> check if at least 10 radar locations were found
# and at least 5 of them match with the provided one
# radar locations can change over time -> check if at least 10 radar locations
# were found and at least 5 of them match with the provided one
assert len(requested_attrs["radarlocations"]) >= 10
assert (
len(list(set(requested_attrs["radarlocations"]) & set(attrs["radarlocations"])))
Expand All @@ -110,6 +115,7 @@ def test_radar_request_composite_latest_rw_reflectivity():
assert requested_attrs == attrs


@windows_unsupported
@pytest.mark.remote
def test_radar_request_site_latest_dx_reflectivity():
"""
Expand Down
13 changes: 8 additions & 5 deletions tests/provider/dwd/radar/test_api_most_recent.py
Expand Up @@ -2,11 +2,13 @@
# Copyright (c) 2018-2021, earthobservations developers.
# Distributed under the MIT License. See LICENSE for more info.


import pytest
import wradlib as wrl

from tests.provider.dwd.radar import station_reference_pattern_unsorted
from tests import windows, windows_unsupported

if not windows:
import wradlib as wrl

from wetterdienst.provider.dwd.radar import (
DwdRadarParameter,
DwdRadarPeriod,
Expand Down Expand Up @@ -117,6 +119,7 @@ def test_radar_request_site_most_recent_sweep_vol_v_hdf5():
assert hdf["/dataset1/how"].attrs.get("scan_index") == 2


@windows_unsupported
def test_radar_request_radolan_cdc_most_recent():
"""
Example for testing radar sites most recent RADOLAN_CDC.
Expand Down Expand Up @@ -194,8 +197,8 @@ def test_radar_request_radolan_cdc_most_recent():
del requested_attrs["radolanversion"]
del requested_attrs["radardays"]

# radarlocations can change over time -> check if at least 10 radar locations were found
# and at least 5 of them match with the provided one
# radar locations can change over time -> check if at least 10 radar locations
# were found and at least 5 of them match with the provided one
assert len(requested_attrs["radarlocations"]) >= 10
assert (
len(list(set(requested_attrs["radarlocations"]) & set(attrs["radarlocations"])))
Expand Down

0 comments on commit db0c181

Please sign in to comment.