Skip to content

Commit

Permalink
ISSUE-204 Activate test_intersect_proximity for TravisCI (#206)
Browse files Browse the repository at this point in the history
* ISSUE-204 Activate test_intersect_proximity for TravisCI
  • Loading branch information
lewismc committed Nov 28, 2019
1 parent 34a97fa commit 7b143dd
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 23 deletions.
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ notifications:
secure: QmVT4vcgQDGpUHWFsJTYxhvr50srdr+aPpiavmFEwnVG3cq78pX1vTueT/Iy+hV3LFpownYu4cvzKNVw2U9UuHdqnuPdIRp+3ggYuEtHJXyn6mMFR1N52zeDvELmskiOEqgHBrrGuqFTgi67jpnCRTrjebYf2YPEUVHyyI0f5isRCo9/rWeK1uUqlICjPLyu/ixBKxyUShQjg8je9PW/9XdtqdqNipLOC4Ppp3JGh6J4B5hK5g5Z5g6ZGBBbq+H6+Spm/vL5FvL/7QRGWWysWTo8b8d5VThzWaHhDZC6PU32+178z4n6/MyDro5metWhjttcdgzjDRw+MLHtdgtlRwKR72zesM1RdbgfC/Uj3xdI8sZ1d05p5TnAj+YRwJ+Qe2WEgJ5Ypu1d+qJYd4P4uYHuIYnkJLcW8593WUJXwK13hY4AZ3n4nLLrJfiPz+iZnZVBxusPF6lVOsxtA28DeCLpEN4I4ut1EOxLC3sIa6vYF7a6sK2ELl3koLhjxfiTm9klDe4WvYZmh/6ofVbRMYQ/8zZr2aXqaSYf2wqVycHHuXfdB+TlifnL63HJO5PpyTGZSucVj+9X1HsDKpZSfhKBGk4vtKGUP6SLDGC/Py4F4h2dZ9i1tyM0Fr7QkJ138joIna5PWY5ZqzqnnJhqmJ+gju7rPNc4hnHtOpoa7LE=
cache:
- pip
install:
before_install:
- sudo add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable
- sudo apt-get update
- sudo apt-get -y install python-dev python-pip
- sudo apt-get -y install python-dev python-pip libgdal-dev gdal-bin python-gdal python3-gdal
- pip install coverage python-coveralls
install:
- python setup.py install
- pip install spectral coverage python-coveralls
script:
- nosetests --with-coverage --cover-package=pycoal -v
after_success:
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ RUN echo "deb-src http://qgis.org/debian jessie main" >> /etc/apt/sources.list
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-key 073D307A618E5811
# dput breaks Docker build
RUN printf "Package: dput\nPin: origin \"\"\nPin-Priority: -1" >> /etc/apt/preferences
#RUN add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable
RUN apt-get install gdal-bin #2.4.2+dfsg-1
RUN add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable
RUN apt-get install gdal-bin python-gdal python3-gdal

# Download GDAL
#ENV GDAL_VERSION 3.0.1
Expand Down
2 changes: 1 addition & 1 deletion pycoal/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def proximity(feature_filename, proximity_filename):
"""
Generate a proximity map from the features.
N.B. it is essential to have
`GDAL's gdal_proximity.py <http://www.gdal.org/gdal_proximity.html>`_
`GDAL's gdal_proximity.py <https://gdal.org/programs/gdal_proximity.html>`_
available somewhere on the path. If running Mac OSX, this function will
scan ``/Library/Frameworks/GDAL.framework/.../gdal_proximity.py`` (
which is where
Expand Down
31 changes: 14 additions & 17 deletions pycoal/tests/environment_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
# Floor, Boston, MA 02110-1301, USA.

from nose import with_setup
from unittest import skipIf
import test

from os import environ
from os.path import abspath, basename, splitext
import numpy
import spectral
Expand Down Expand Up @@ -46,7 +44,7 @@

# test files for proximity intersection test
mining_filename = 'images/ang20150420t182050_corr_v1e_img_class_mining_cut.hdr'
vector_filename = 'images/NHDFlowline_cut.shp'
vector_filename = ['images/NHDFlowline_cut.shp']
proximity = 10.0
correlated_filename = 'images' \
'/ang20150420t182050_corr_v1e_img_class_mining_cut' \
Expand All @@ -59,24 +57,23 @@
# remove generated files
def _test_intersect_proximity_teardown():
mining_name = splitext(basename(abspath(mining_filename)))[0]
vector_name = splitext(basename(abspath(vector_filename)))[0]
output_directory = 'images'
feature_header_name = output_directory + '/' + mining_name + '_' + \
vector_name + '.hdr'
feature_image_name = feature_header_name[:-4] + '.img'
proximity_header_name = output_directory + '/' + mining_name + '_' + \
vector_name + '_proximity.hdr'
proximity_image_name = proximity_header_name[:-4] + '.img'
test_image_name = test_filename[:-4] + '.img'
test.remove_files(
[feature_header_name, feature_image_name, proximity_header_name,
proximity_image_name, test_filename, test_image_name])
for vector_file in vector_filename:
vector_name = splitext(basename(abspath(vector_file)))[0]
output_directory = 'images'
feature_header_name = output_directory + '/' + mining_name + '_' + \
vector_name + '.hdr'
feature_image_name = feature_header_name[:-4] + '.img'
proximity_header_name = output_directory + '/' + mining_name + '_' + \
vector_name + '_proximity.hdr'
proximity_image_name = proximity_header_name[:-4] + '.img'
test_image_name = test_filename[:-4] + '.img'
test.remove_files(
[feature_header_name, feature_image_name, proximity_header_name,
proximity_image_name, test_filename, test_image_name])


# verify that proximity intersection produces expected results
@with_setup(None, _test_intersect_proximity_teardown)
@skipIf(environ.get('CONTINUOUS_INTEGRATION'),
'Skip test because GDAL not installed on server.')
def test_intersect_proximity():
ec = environment.EnvironmentalCorrelation()
ec.intersect_proximity(mining_filename, vector_filename, proximity,
Expand Down

0 comments on commit 7b143dd

Please sign in to comment.