diff --git a/appveyor.yml b/appveyor.yml index 7a211e88..436c411d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,42 +1,66 @@ # version here is only relevant for the AppVeyor CI, no need to adjust version: '{build}' +image: + - macOS + - Ubuntu2004 + +platform: + - x64 + environment: - global: - PYTHON_LOC: "C:\\Miniconda37-x64" + # For the unit-tests, disable Numba JIT, otherwise Coverage wont reach the actual Python code + NUMBA_DISABLE_JIT: 1 + # Uncomment following line if web testing breaks our build + CATE_DISABLE_WEB_TESTS: 1 + # geopandas in tests break the build on appveyor (maybe the problem of gdal?) + CATE_DISABLE_GEOPANDAS_TESTS: 1 + CATE_DISABLE_PLOT_TESTS: 1 + CATE_DISABLE_CLI_UPDATE_TESTS: 1 + +for: +- + matrix: + only: + - image: macOS + install: + - curl -L https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh > miniconda.sh + - bash miniconda.sh -b -p $HOME/miniconda +- + matrix: + only: + - image: Ubuntu2004 + install: + - wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh + - bash miniconda.sh -b -p $HOME/miniconda -install: - - call %PYTHON_LOC%\Scripts\activate.bat +build_script: + - export PATH="$HOME/miniconda/bin:$PATH" + - hash -r - conda config --set always_yes yes --set changeps1 no - conda config --set channel_priority strict - conda update -q conda - conda info -a - - conda install -c conda-forge -n base mamba + - conda init bash + - export CONDA_BASE=$(conda info --base) + - source $CONDA_BASE/etc/profile.d/conda.sh + - conda install -c conda-forge -n base mamba pip -build_script: - - call %PYTHON_LOC%\Scripts\activate.bat - git clone https://github.com/dcs4cop/xcube.git - git clone https://github.com/dcs4cop/xcube-cci.git # Install xcube env and xcube - cd xcube - mamba env create - conda activate xcube - - python setup.py develop + - pip install -e . # Install xcube-cci - - cd ..\xcube-cci + - cd .. + - cd xcube-cci - mamba install -c conda-forge lxml pydap aiohttp nest-asyncio - - python setup.py develop + - pip install -e . # Install cate-specific packages - cd .. - mamba install -c conda-forge cartopy - - python setup.py develop + - pip install -e . - conda list - # For the unit-tests, disable Numba JIT, otherwise Coverage wont reach the actual Python code - - set NUMBA_DISABLE_JIT=1 - # Uncomment following line if web testing on travis breaks our build - - set CATE_DISABLE_WEB_TESTS=1 - # geopandas in tests break the build on appveyor (maybe the problem of gdal?) - - set CATE_DISABLE_GEOPANDAS_TESTS=1 - - set CATE_DISABLE_PLOT_TESTS=1 - - set CATE_DISABLE_CLI_UPDATE_TESTS=1 - pytest -v --cov=cate tests diff --git a/cate/webapi/geojson.py b/cate/webapi/geojson.py index e119b5f4..7dfadb94 100644 --- a/cate/webapi/geojson.py +++ b/cate/webapi/geojson.py @@ -276,6 +276,18 @@ def write_feature_collection(feature_collection: Union[fiona.Collection, Iterabl if num_features_written > 0: io.write(',\n') io.flush() + # fiona >=1.9 returns features of type fiona.model.Feature + # rather than JSON-serializable dictionaries. + if hasattr(feature, '__geo_interface__'): + # We fall back on the traditional geo-interface: + feature = feature.__geo_interface__ + # Fiona =1.9.0 adds empty "geometries" field + # to any "geometry", we fix this too: + geometry = feature.get('geometry') + if geometry \ + and "geometries" in geometry \ + and geometry.get("type") != "GeometryCollection": + del geometry["geometries"] if res_id is not None: feature['_resId'] = res_id feature['_idx'] = feature_index diff --git a/tests/ops/test_utility.py b/tests/ops/test_utility.py index 78119f86..2103b5ad 100644 --- a/tests/ops/test_utility.py +++ b/tests/ops/test_utility.py @@ -276,7 +276,7 @@ def test_alloc_memory(self): no_op(step_duration=0, num_steps=3, memory_alloc='120M') no_op(step_duration=0, num_steps=200, memory_alloc='124B') no_op(step_duration=0, num_steps=2, memory_alloc='0.1G') - no_op(step_duration=0, num_steps=1, memory_alloc='0.01T') + no_op(step_duration=0, num_steps=1, memory_alloc='0.001T') with self.assertRaises(ValueError): no_op(step_duration=0, num_steps=5, memory_alloc='x')