Skip to content

Commit c6b58ca

Browse files
CI: Fix minimal test env and remove deps on pandas / geopandas (#134)
Co-authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
1 parent dbe3d90 commit c6b58ca

File tree

4 files changed

+27
-8
lines changed

4 files changed

+27
-8
lines changed

.github/workflows/tests-conda.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ jobs:
2424
matrix:
2525
os: [ubuntu-latest, macos-latest, windows-2019]
2626
python: ["3.9", "3.10"]
27+
env: ["environment.yml"]
28+
include:
29+
# minimal environment without optional dependencies
30+
- os: "ubuntu-latest"
31+
python: "3.10"
32+
env: "environment-minimal.yml"
2733

2834
steps:
2935
- name: Checkout repo
@@ -32,7 +38,7 @@ jobs:
3238
- name: Install Conda environment with Micromamba
3339
uses: mamba-org/provision-with-micromamba@main
3440
with:
35-
environment-file: ci/environment.yml
41+
environment-file: ci/${{ matrix.env }}
3642
extra-specs: python=${{ matrix.python }}
3743
cache-env: true
3844

ci/environment-minimal.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: test
2+
channels:
3+
- conda-forge
4+
dependencies:
5+
- numpy
6+
- libgdal
7+
- pytest
8+

pyogrio/tests/conftest.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import pytest
55

66
from pyogrio import __gdal_version_string__, __version__, list_drivers
7-
import pyogrio
7+
from pyogrio.raw import read, write
88

99

1010
_data_dir = Path(__file__).parent.resolve() / "fixtures"
@@ -27,12 +27,16 @@ def prepare_testfile(testfile_path, dst_dir, ext):
2727
dst_path = dst_dir / f"{testfile_path.stem}{ext}"
2828
if dst_path.exists():
2929
return dst_path
30-
gdf = pyogrio.read_dataframe(testfile_path)
30+
31+
meta, _, geometry, field_data = read(testfile_path)
32+
3133
if ext == ".fgb":
3234
# For .fgb, spatial_index=False to avoid the rows being reordered
33-
pyogrio.write_dataframe(gdf, dst_path, spatial_index=False)
34-
else:
35-
pyogrio.write_dataframe(gdf, dst_path)
35+
meta["spatial_index"] = False
36+
# allow mixed Polygons/MultiPolygons type
37+
meta["geometry_type"] = "Unknown"
38+
39+
write(dst_path, geometry, field_data, **meta)
3640
return dst_path
3741

3842

pyogrio/tests/test_geopandas_io.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
import os
33

44
import numpy as np
5-
import pandas as pd
6-
from pandas.testing import assert_frame_equal, assert_index_equal
75
import pytest
86

97
from pyogrio import list_layers, read_info, __gdal_geos_version__
@@ -13,6 +11,9 @@
1311
from pyogrio.tests.conftest import ALL_EXTS
1412

1513
try:
14+
import pandas as pd
15+
from pandas.testing import assert_frame_equal, assert_index_equal
16+
1617
import geopandas as gp
1718
from geopandas.testing import assert_geodataframe_equal
1819

0 commit comments

Comments
 (0)