From 24a1a7657376920cb1e00ea856c9934d4f976349 Mon Sep 17 00:00:00 2001 From: David Hoese Date: Wed, 19 Jul 2023 13:02:13 -0500 Subject: [PATCH] Try more test hacking to get reproducible example --- .github/workflows/ci.yaml | 12 ------------ satpy/tests/enhancement_tests/test_enhancements.py | 12 +++++++----- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index cfb076da5a..770eb9242a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -66,18 +66,6 @@ jobs: shell: bash -l {0} run: | pytest satpy/tests/enhancement_tests/test_enhancements.py::test_nwcsaf_comps - - name: Run unit tests - enhancement_tests - enhancements - shell: bash -l {0} - run: | - pytest satpy/tests/enhancement_tests/test_enhancements.py - - name: Run unit tests - enhancement_tests - viirs - shell: bash -l {0} - run: | - pytest satpy/tests/enhancement_tests/test_viirs.py - - name: Run unit tests - modifier_tests - shell: bash -l {0} - run: | - pytest satpy/tests/modifier_tests - name: Run unit tests - scene_tests shell: bash -l {0} run: | diff --git a/satpy/tests/enhancement_tests/test_enhancements.py b/satpy/tests/enhancement_tests/test_enhancements.py index ecae1aa9d8..dcc3ed98db 100644 --- a/satpy/tests/enhancement_tests/test_enhancements.py +++ b/satpy/tests/enhancement_tests/test_enhancements.py @@ -17,6 +17,7 @@ import contextlib import os +from datetime import datetime from tempfile import NamedTemporaryFile from unittest import mock @@ -577,23 +578,22 @@ def fake_area(): ) def test_nwcsaf_comps(fake_area, tmp_path, data): """Test loading NWCSAF composites.""" - return from satpy.writers import get_enhanced_image from ... import Scene (flavour, dvname, altname, palettename, statusname, comp, filelabel, dtp) = _nwcsaf_geo_props[data] rng = (0, 100) if dtp == "uint8" else (-100, 1000) + now = datetime.utcnow() if flavour == "geo": - fn = f"S_NWC_{filelabel:s}_MSG2_MSG-N-VISIR_20220124T094500Z.nc" + fn = f"S_NWC_{filelabel:s}_MSG2_MSG-N-VISIR_{now:%Y%m%dT%H%M%S}Z.nc" reader = "nwcsaf-geo" id_ = {"satellite_identifier": "MSG4"} else: - fn = f"S_NWC_{filelabel:s}_noaa20_00000_20230301T1200213Z_20230301T1201458Z.nc" + fn = f"S_NWC_{filelabel:s}_noaa20_00000_{now:%Y%m%dT%H%M%S}0Z_{now:%Y%m%dT%H%M%S}0Z.nc" reader = "nwcsaf-pps_nc" id_ = {"platform": "NOAA-20"} fk = tmp_path / fn - # create a minimally fake netCDF file, otherwise satpy won't load the - # composite + # create a minimally fake netCDF file, otherwise satpy won't load the composite ds = xr.Dataset( coords={"nx": [0], "ny": [0]}, attrs={ @@ -604,6 +604,8 @@ def test_nwcsaf_comps(fake_area, tmp_path, data): ) ds.attrs.update(id_) ds.to_netcdf(fk) + import time + time.sleep(1) # sc = Scene(filenames=[os.fspath(fk)], reader=[reader]) # sc[palettename] = xr.DataArray( # da.tile(da.arange(256), [3, 1]).T,