Repository: geopandas/geopandas
Pull request #3387 (2024-07-22 11:18:43)

TST/CI: show xfails in test summary again
This reverts #3186, as pytest [8.3](https://github.com/pytest-dev/pytest/releases/tag/8.3.0) now moves the xfail tracebacks to a new flag and restores the pre 8.0 behaviour for the `-ra` option ([12231](https://github.com/pytest-dev/pytest/pull/12280))



Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 51217980..89da9029 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,13 @@
 Bug fixes:
 
 - Properly support named aggregations over a geometry column in `GroupBy.agg` (#3368).
+- Fix regression where constructing a GeoSeries from a pd.Series with GeometryDtype values 
+  failed when `crs` was provided(#3383).
+
+Deprecations and compatibility notes:
+
+- The `GeoSeries.select` method wrapping the pandas `Series.select` method has been removed.
+  The upstream method no longer exists in all supported version of pandas (#3394).
 
 ## Version 1.0.1 (July 2, 2024)
 
diff --git a/doc/source/conf.py b/doc/source/conf.py
index da5107a5..2f55e987 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -246,6 +246,13 @@ html_additional_pages = {page[0]: "redirect.html" for page in moved_pages}
 
 html_context = {"redirects": {old: new for old, new in moved_pages}}
 
+# Define the canonical URL if you are using a custom domain on Read the Docs
+html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "")
+
+# Tell Jinja2 templates the build is running on Read the Docs
+if os.environ.get("READTHEDOCS", "") == "True":
+    html_context["READTHEDOCS"] = True
+
 # If false, no module index is generated.
 # html_domain_indices = True
 
diff --git a/geopandas/geoseries.py b/geopandas/geoseries.py
index ea30f61d..4eaa4d3a 100644
--- a/geopandas/geoseries.py
+++ b/geopandas/geoseries.py
@@ -164,7 +164,7 @@ class GeoSeries(GeoPandasBase, Series):
                 # make a copy to avoid setting CRS to passed GeometryArray
                 data = data.copy()
             else:
-                if not data.crs == crs:
+                if not data_crs == crs:
                     raise ValueError(
                         "CRS mismatch between CRS of the passed geometries "
                         "and 'crs'. Use 'GeoSeries.set_crs(crs, "
@@ -734,10 +734,6 @@ class GeoSeries(GeoPandasBase, Series):
     def take(self, *args, **kwargs):
         return self._wrapped_pandas_method("take", *args, **kwargs)
 
-    @doc(pd.Series)
-    def select(self, *args, **kwargs):
-        return self._wrapped_pandas_method("select", *args, **kwargs)
-
     @doc(pd.Series)
     def apply(self, func, convert_dtype: Optional[bool] = None, args=(), **kwargs):
         if convert_dtype is not None:


Test patch:
diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml
index 4e419a47..2cbc1083 100644
--- a/.github/workflows/tests.yaml
+++ b/.github/workflows/tests.yaml
@@ -88,7 +88,7 @@ jobs:
 
       - name: Test
         run: |
-          pytest -v -r fEs -n auto --color=yes --cov=geopandas --cov-append --cov-report term-missing --cov-report xml geopandas/
+          pytest -v -r a -n auto --color=yes --cov=geopandas --cov-append --cov-report term-missing --cov-report xml geopandas/
 
       - name: Test with PostGIS
         if: (contains(matrix.env, '310-pd20-conda-forge.yaml') || contains(matrix.env, '311-latest-conda-forge.yaml'))
@@ -102,7 +102,7 @@ jobs:
           conda install postgis -c conda-forge
           sh ci/scripts/setup_postgres.sh
           set -o pipefail
-          pytest -v -r fEs --color=yes --cov=geopandas --cov-append --cov-report term-missing --cov-report xml geopandas/io/tests/test_sql.py | tee /dev/stderr | if grep SKIPPED >/dev/null;then echo "TESTS SKIPPED, FAILING" && exit 1;fi
+          pytest -v -r a --color=yes --cov=geopandas --cov-append --cov-report term-missing --cov-report xml geopandas/io/tests/test_sql.py | tee /dev/stderr | if grep SKIPPED >/dev/null;then echo "TESTS SKIPPED, FAILING" && exit 1;fi
 
       - name: Test docstrings
         if: contains(matrix.env, '310-pd20-conda-forge.yaml') && contains(matrix.os, 'ubuntu')
diff --git a/geopandas/tests/test_geoseries.py b/geopandas/tests/test_geoseries.py
index 39590176..4d2e2b54 100644
--- a/geopandas/tests/test_geoseries.py
+++ b/geopandas/tests/test_geoseries.py
@@ -673,6 +673,16 @@ class TestConstructor:
         assert gs.crs is None
         assert result.crs == "EPSG:4326"
 
+        # https://github.com/geopandas/geopandas/issues/3382
+        s2 = pd.Series(gs.set_crs("EPSG:4326"))
+        result = GeoSeries(s2, crs=4326)
+        assert result.crs == "EPSG:4326"
+        with pytest.raises(
+            ValueError,
+            match="CRS mismatch between CRS of the passed geometries and 'crs'",
+        ):
+            GeoSeries(s2, crs=4283)
+
     def test_copy(self):
         # default is to copy with CoW / pandas 3+
         arr = np.array([Point(x, x) for x in range(3)], dtype=object)