Skip to content

Commit

Permalink
CI: Fix minimal test env and remove deps on pandas / geopandas (#134)
Browse files Browse the repository at this point in the history
Co-authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
  • Loading branch information
brendan-ward and jorisvandenbossche authored Jun 19, 2022
1 parent dbe3d90 commit c6b58ca
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/tests-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
8 changes: 8 additions & 0 deletions ci/environment-minimal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: test
channels:
- conda-forge
dependencies:
- numpy
- libgdal
- pytest

14 changes: 9 additions & 5 deletions pyogrio/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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


Expand Down
5 changes: 3 additions & 2 deletions pyogrio/tests/test_geopandas_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__
Expand All @@ -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

Expand Down

0 comments on commit c6b58ca

Please sign in to comment.