From a98fa90f50302f553267da5068c831d1f6dcfeef Mon Sep 17 00:00:00 2001 From: "Soroosh.Mani" Date: Fri, 17 Nov 2023 23:07:39 -0500 Subject: [PATCH] Fix final issues with CI --- .github/workflows/functional_test.yml | 4 ++-- ocsmesh/raster.py | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/functional_test.yml b/.github/workflows/functional_test.yml index fa3aa9b..4b90095 100644 --- a/.github/workflows/functional_test.yml +++ b/.github/workflows/functional_test.yml @@ -53,7 +53,7 @@ jobs: gdalwarp -tr 0.0005 0.0005 -r average -overwrite /tmp/fullsize_dem.tif /tmp/test_dem.tif - name: Export Conda environment - shell: bash -l {0} + shell: bash -el {0} run: conda list > environment_py${{ matrix.python-version }}.yml - name: 'Upload conda environment' @@ -112,5 +112,5 @@ jobs: retention-days: 7 - name: Run Python API tests - shell: bash -l {0} + shell: bash -el {0} run: python -m unittest discover tests/api -p "*.py" diff --git a/ocsmesh/raster.py b/ocsmesh/raster.py index ad29476..fe1c579 100644 --- a/ocsmesh/raster.py +++ b/ocsmesh/raster.py @@ -395,6 +395,7 @@ def modifying_raster( """ no_except = False + tmpfd = None try: # pylint: disable=R1732 # tmpfile = tempfile.NamedTemporaryFile(prefix=tmpdir, mode='w') @@ -420,7 +421,8 @@ def modifying_raster( # We don't need to keep the descriptor open, we kept it # open # so that there's no race condition on the temp # file up to now - os.close(tmpfd) + if tmpfd is not None: + os.close(tmpfd) @@ -964,7 +966,7 @@ def average_filter( # modifying the raster (e.g. hfun add_contour is affected) if platform.system() == 'Windows': - raise ImplementationError('Not supported on Windows!') + raise NotImplementedError('Not supported on Windows!') bands = apply_on_bands if bands is None: bands = range(1, self.src.count + 1) @@ -1024,7 +1026,7 @@ def generic_filter(self, function, **kwargs: Any) -> None: """ if platform.system() == 'Windows': - raise ImplementationError('Not supported on Windows!') + raise NotImplementedError('Not supported on Windows!') # TODO: Don't overwrite; add additoinal bands for filtered values