TST: Use the full path for examples directory

This commit is contained in:
Kelsey Jordahl authored and Joris Van den Bossche committed 2016-04-27 23:58:08 +02:00
1 parent cbc479f46b
commit c8fb3de4a1
2 files changed
+6 -3

No files matched your search

+2 -2
View File
@@ -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):
+4 -1
View File
@@ -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))