diff --git a/.github/workflows/tests-conda.yml b/.github/workflows/tests-conda.yml index 43e5d22a..4d635041 100644 --- a/.github/workflows/tests-conda.yml +++ b/.github/workflows/tests-conda.yml @@ -24,6 +24,12 @@ jobs: matrix: os: [ubuntu-latest, macos-latest, windows-2019] python: ["3.9", "3.10"] + env: ["environment.yml"] + include: + # minimal environment without optional dependencies + - os: "ubuntu-latest" + python: "3.10" + env: "environment-minimal.yml" steps: - name: Checkout repo @@ -32,7 +38,7 @@ jobs: - name: Install Conda environment with Micromamba uses: mamba-org/provision-with-micromamba@main with: - environment-file: ci/environment.yml + environment-file: ci/${{ matrix.env }} extra-specs: python=${{ matrix.python }} cache-env: true diff --git a/ci/environment-minimal.yml b/ci/environment-minimal.yml new file mode 100644 index 00000000..a9e57496 --- /dev/null +++ b/ci/environment-minimal.yml @@ -0,0 +1,8 @@ +name: test +channels: + - conda-forge +dependencies: + - numpy + - libgdal + - pytest + diff --git a/pyogrio/tests/conftest.py b/pyogrio/tests/conftest.py index 734cbb59..07027d3e 100644 --- a/pyogrio/tests/conftest.py +++ b/pyogrio/tests/conftest.py @@ -4,7 +4,7 @@ import pytest from pyogrio import __gdal_version_string__, __version__, list_drivers -import pyogrio +from pyogrio.raw import read, write _data_dir = Path(__file__).parent.resolve() / "fixtures" @@ -27,12 +27,16 @@ def prepare_testfile(testfile_path, dst_dir, ext): dst_path = dst_dir / f"{testfile_path.stem}{ext}" if dst_path.exists(): return dst_path - gdf = pyogrio.read_dataframe(testfile_path) + + meta, _, geometry, field_data = read(testfile_path) + if ext == ".fgb": # For .fgb, spatial_index=False to avoid the rows being reordered - pyogrio.write_dataframe(gdf, dst_path, spatial_index=False) - else: - pyogrio.write_dataframe(gdf, dst_path) + meta["spatial_index"] = False + # allow mixed Polygons/MultiPolygons type + meta["geometry_type"] = "Unknown" + + write(dst_path, geometry, field_data, **meta) return dst_path diff --git a/pyogrio/tests/test_geopandas_io.py b/pyogrio/tests/test_geopandas_io.py index 707870c9..9162e0d5 100644 --- a/pyogrio/tests/test_geopandas_io.py +++ b/pyogrio/tests/test_geopandas_io.py @@ -2,8 +2,6 @@ import os import numpy as np -import pandas as pd -from pandas.testing import assert_frame_equal, assert_index_equal import pytest from pyogrio import list_layers, read_info, __gdal_geos_version__ @@ -13,6 +11,9 @@ from pyogrio.tests.conftest import ALL_EXTS try: + import pandas as pd + from pandas.testing import assert_frame_equal, assert_index_equal + import geopandas as gp from geopandas.testing import assert_geodataframe_equal