diff --git a/geopandas/tests/test_geodataframe.py b/geopandas/tests/test_geodataframe.py index bae5fce..affae3d 100644 --- a/geopandas/tests/test_geodataframe.py +++ b/geopandas/tests/test_geodataframe.py @@ -13,7 +13,7 @@ from shapely.geometry import Point, Polygon import fiona from geopandas import GeoDataFrame, read_file, GeoSeries from geopandas.tests.util import unittest, download_nybb, assert_geoseries_equal, \ - connect, create_db, validate_boro_df, PANDAS_NEW_SQL_API + connect, create_db, validate_boro_df, PACKAGE_DIR, PANDAS_NEW_SQL_API class TestDataFrame(unittest.TestCase): @@ -32,7 +32,7 @@ class TestDataFrame(unittest.TestCase): self.df2 = GeoDataFrame([ {'geometry': Point(x, y), 'value1': x + y, 'value2': x * y} for x, y in zip(range(N), range(N))], crs=self.crs) - self.df3 = read_file('examples/null_geom.geojson') + self.df3 = read_file(os.path.join(PACKAGE_DIR, 'examples', 'null_geom.geojson')) self.line_paths = self.df3['Name'] def tearDown(self): diff --git a/geopandas/tests/util.py b/geopandas/tests/util.py index 6503e2d..74c5878 100644 --- a/geopandas/tests/util.py +++ b/geopandas/tests/util.py @@ -5,6 +5,9 @@ from six.moves.urllib.request import urlopen from geopandas import GeoDataFrame, GeoSeries +HERE = os.path.abspath(os.path.dirname(__file__)) +PACKAGE_DIR = os.path.dirname(os.path.dirname(HERE)) + # Compatibility layer for Python 2.6: try loading unittest2 import sys if sys.version_info[:2] == (2, 6): @@ -43,7 +46,7 @@ def download_nybb(): # Data from http://www.nyc.gov/html/dcp/download/bytes/nybb_14aav.zip # saved as geopandas/examples/nybb_14aav.zip. filename = 'nybb_16a.zip' - full_path_name = os.path.join('examples', filename) + full_path_name = os.path.join(PACKAGE_DIR, 'examples', filename) if not os.path.exists(full_path_name): with io.open(full_path_name, 'wb') as f: response = urlopen('http://www1.nyc.gov/assets/planning/download/zip/data-maps/open-data/{0}'.format(filename))