From bddfa20bcedef396b30594a067400b56c7d8d832 Mon Sep 17 00:00:00 2001 From: Kelsey Jordahl Date: Mon, 21 Apr 2014 07:40:01 -0400 Subject: [PATCH] TST: Skip PostGIS tests for recent pandas master due to SQL API change (GH#98) --- tests/test_geodataframe.py | 6 +++++- tests/test_io.py | 7 ++++++- tests/util.py | 7 +++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/tests/test_geodataframe.py b/tests/test_geodataframe.py index b59c3c9..3458772 100644 --- a/tests/test_geodataframe.py +++ b/tests/test_geodataframe.py @@ -13,7 +13,7 @@ from shapely.geometry import Point, Polygon import fiona from geopandas import GeoDataFrame, read_file, GeoSeries from .util import unittest, download_nybb, assert_geoseries_equal, connect, \ - create_db, validate_boro_df + create_db, validate_boro_df, PANDAS_NEW_SQL_API class TestDataFrame(unittest.TestCase): @@ -363,6 +363,8 @@ class TestDataFrame(unittest.TestCase): {'a': 2, 'b': np.nan}]) assert_frame_equal(expected, result) + @unittest.skipIf(PANDAS_NEW_SQL_API, 'Development version of pandas ' + 'not yet supported in SQL API.') def test_from_postgis_default(self): con = connect('test_geopandas') if con is None or not create_db(self.df): @@ -376,6 +378,8 @@ class TestDataFrame(unittest.TestCase): validate_boro_df(self, df) + @unittest.skipIf(PANDAS_NEW_SQL_API, 'Development version of pandas ' + 'not yet supported in SQL API.') def test_from_postgis_custom_geom_col(self): con = connect('test_geopandas') if con is None or not create_db(self.df): diff --git a/tests/test_io.py b/tests/test_io.py index 8372caf..6eb5f72 100644 --- a/tests/test_io.py +++ b/tests/test_io.py @@ -4,7 +4,8 @@ import fiona from geopandas import GeoDataFrame, read_postgis, read_file import tests.util -from .util import unittest +from .util import PANDAS_NEW_SQL_API, unittest + class TestIO(unittest.TestCase): def setUp(self): @@ -15,6 +16,8 @@ class TestIO(unittest.TestCase): with fiona.open(path, vfs=vfs) as f: self.crs = f.crs + @unittest.skipIf(PANDAS_NEW_SQL_API, 'Development version of pandas ' + 'not yet supported in SQL API.') def test_read_postgis_default(self): con = tests.util.connect('test_geopandas') if con is None or not tests.util.create_db(self.df): @@ -28,6 +31,8 @@ class TestIO(unittest.TestCase): tests.util.validate_boro_df(self, df) + @unittest.skipIf(PANDAS_NEW_SQL_API, 'Development version of pandas ' + 'not yet supported in SQL API.') def test_read_postgis_custom_geom_col(self): con = tests.util.connect('test_geopandas') if con is None or not tests.util.create_db(self.df): diff --git a/tests/util.py b/tests/util.py index 1118953..57b9b7b 100644 --- a/tests/util.py +++ b/tests/util.py @@ -22,6 +22,13 @@ except ImportError: class OperationalError(Exception): pass +try: + from pandas import read_sql_table +except ImportError: + PANDAS_NEW_SQL_API = False +else: + PANDAS_NEW_SQL_API = True + def download_nybb(): """ Returns the path to the NYC boroughs file. Downloads if necessary. """