in addition, removed skipdata decorators and scm imports for most tests. see #BITBUCKET-3790.
This commit is contained in:
parent
683ec684d5
commit
67e4b50522
|
@ -5,7 +5,6 @@ import shutil
|
|||
import os
|
||||
|
||||
import pandas
|
||||
from pygeoprocessing.testing import scm
|
||||
|
||||
MODEL_DATA_PATH = os.path.join(
|
||||
os.path.dirname(__file__), '..', 'data', 'invest-test-data',
|
||||
|
@ -31,8 +30,6 @@ class CropProductionTests(unittest.TestCase):
|
|||
"""Overriding tearDown function to remove temporary directory."""
|
||||
shutil.rmtree(self.workspace_dir)
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA_PATH)
|
||||
@scm.skip_if_data_missing(MODEL_DATA_PATH)
|
||||
def test_crop_production_percentile(self):
|
||||
"""Crop Production: test crop production percentile regression."""
|
||||
from natcap.invest import crop_production_percentile
|
||||
|
@ -62,8 +59,6 @@ class CropProductionTests(unittest.TestCase):
|
|||
pandas.testing.assert_frame_equal(
|
||||
expected_result_table, result_table, check_dtype=False)
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA_PATH)
|
||||
@scm.skip_if_data_missing(MODEL_DATA_PATH)
|
||||
def test_crop_production_percentile_bad_crop(self):
|
||||
"""Crop Production: test crop production with a bad crop name."""
|
||||
from natcap.invest import crop_production_percentile
|
||||
|
@ -89,8 +84,6 @@ class CropProductionTests(unittest.TestCase):
|
|||
with self.assertRaises(ValueError):
|
||||
crop_production_percentile.execute(args)
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA_PATH)
|
||||
@scm.skip_if_data_missing(MODEL_DATA_PATH)
|
||||
def test_crop_production_regression_bad_crop(self):
|
||||
"""Crop Production: test crop regression with a bad crop name."""
|
||||
from natcap.invest import crop_production_regression
|
||||
|
@ -121,8 +114,6 @@ class CropProductionTests(unittest.TestCase):
|
|||
with self.assertRaises(ValueError):
|
||||
crop_production_regression.execute(args)
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA_PATH)
|
||||
@scm.skip_if_data_missing(MODEL_DATA_PATH)
|
||||
def test_crop_production_regression(self):
|
||||
"""Crop Production: test crop production regression model."""
|
||||
from natcap.invest import crop_production_regression
|
||||
|
|
|
@ -5,7 +5,6 @@ import shutil
|
|||
import os
|
||||
|
||||
import pygeoprocessing
|
||||
from pygeoprocessing.testing import scm
|
||||
|
||||
|
||||
SAMPLE_DATA = os.path.join(
|
||||
|
@ -61,8 +60,6 @@ class FinfishTests(unittest.TestCase):
|
|||
}
|
||||
return args
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA)
|
||||
@scm.skip_if_data_missing(REGRESSION_DATA)
|
||||
def test_finfish_full_run(self):
|
||||
"""Finfish: regression test to run model with all options on."""
|
||||
import natcap.invest.finfish_aquaculture.finfish_aquaculture
|
||||
|
@ -85,8 +82,6 @@ class FinfishTests(unittest.TestCase):
|
|||
os.path.join(REGRESSION_DATA, 'Finfish_Harvest.shp'),
|
||||
os.path.join(self.workspace_dir, 'output', 'Finfish_Harvest.shp'), 1E-6)
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA)
|
||||
@scm.skip_if_data_missing(REGRESSION_DATA)
|
||||
def test_finfish_mc_no_valuation(self):
|
||||
"""Finfish: run model with MC analysis and no valuation."""
|
||||
import natcap.invest.finfish_aquaculture.finfish_aquaculture
|
||||
|
|
|
@ -5,7 +5,6 @@ import shutil
|
|||
import os
|
||||
|
||||
import pygeoprocessing.testing
|
||||
from pygeoprocessing.testing import scm
|
||||
from osgeo import ogr
|
||||
import numpy
|
||||
|
||||
|
@ -40,8 +39,6 @@ class GLOBIOTests(unittest.TestCase):
|
|||
"""Overriding tearDown function to remove temporary directory."""
|
||||
shutil.rmtree(self.workspace_dir)
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA)
|
||||
@scm.skip_if_data_missing(REGRESSION_DATA)
|
||||
def test_globio_predefined_lulc(self):
|
||||
"""GLOBIO: regression testing predefined LULC (mode b)."""
|
||||
from natcap.invest import globio
|
||||
|
@ -67,8 +64,6 @@ class GLOBIOTests(unittest.TestCase):
|
|||
os.path.join(args['workspace_dir'], 'msa.tif'),
|
||||
os.path.join(REGRESSION_DATA, 'msa_lulc_regression.tif'), 1e-6)
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA)
|
||||
@scm.skip_if_data_missing(REGRESSION_DATA)
|
||||
def test_globio_empty_infra(self):
|
||||
"""GLOBIO: testing that empty infra directory raises exception."""
|
||||
from natcap.invest import globio
|
||||
|
@ -89,8 +84,6 @@ class GLOBIOTests(unittest.TestCase):
|
|||
with self.assertRaises(ValueError):
|
||||
globio.execute(args)
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA)
|
||||
@scm.skip_if_data_missing(REGRESSION_DATA)
|
||||
def test_globio_shape_infra(self):
|
||||
"""GLOBIO: regression testing with shapefile infrastructure."""
|
||||
from natcap.invest import globio
|
||||
|
@ -117,8 +110,6 @@ class GLOBIOTests(unittest.TestCase):
|
|||
os.path.join(REGRESSION_DATA, 'msa_shape_infra_regression.tif'),
|
||||
1e-6)
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA)
|
||||
@scm.skip_if_data_missing(REGRESSION_DATA)
|
||||
def test_globio_full(self):
|
||||
"""GLOBIO: regression testing all functionality (mode a)."""
|
||||
from natcap.invest import globio
|
||||
|
|
|
@ -5,7 +5,6 @@ import shutil
|
|||
import os
|
||||
|
||||
import pygeoprocessing
|
||||
from pygeoprocessing.testing import scm
|
||||
|
||||
SAMPLE_DATA = os.path.join(
|
||||
os.path.dirname(__file__), '..', 'data', 'invest-test-data',
|
||||
|
@ -28,8 +27,6 @@ class HRATests(unittest.TestCase):
|
|||
"""Overriding tearDown function to remove temporary directory."""
|
||||
shutil.rmtree(self.workspace_dir)
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA)
|
||||
@scm.skip_if_data_missing(REGRESSION_DATA)
|
||||
def test_hra_euc_none(self):
|
||||
"""HRA: euclidean and no decay."""
|
||||
import natcap.invest.habitat_risk_assessment.hra
|
||||
|
@ -57,8 +54,6 @@ class HRATests(unittest.TestCase):
|
|||
self.workspace_dir, 'output', 'Maps', 'ecosys_risk.tif'),
|
||||
1e-6)
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA)
|
||||
@scm.skip_if_data_missing(REGRESSION_DATA)
|
||||
def test_hra_mult_none(self):
|
||||
"""HRA: multiplicative and no decay."""
|
||||
import natcap.invest.habitat_risk_assessment.hra
|
||||
|
@ -86,8 +81,6 @@ class HRATests(unittest.TestCase):
|
|||
self.workspace_dir, 'output', 'Maps', 'ecosys_risk.tif'),
|
||||
1e-6)
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA)
|
||||
@scm.skip_if_data_missing(REGRESSION_DATA)
|
||||
def test_hra_euc_lin(self):
|
||||
"""HRA: euclidean and linear."""
|
||||
import natcap.invest.habitat_risk_assessment.hra
|
||||
|
@ -114,8 +107,6 @@ class HRATests(unittest.TestCase):
|
|||
os.path.join(
|
||||
self.workspace_dir, 'output', 'Maps', 'ecosys_risk.tif'), 1e-6)
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA)
|
||||
@scm.skip_if_data_missing(REGRESSION_DATA)
|
||||
def test_hra_euc_exp(self):
|
||||
"""HRA: euclidean and exponential."""
|
||||
import natcap.invest.habitat_risk_assessment.hra
|
||||
|
@ -143,8 +134,6 @@ class HRATests(unittest.TestCase):
|
|||
self.workspace_dir, 'output', 'Maps', 'ecosys_risk.tif'),
|
||||
1e-6)
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA)
|
||||
@scm.skip_if_data_missing(REGRESSION_DATA)
|
||||
def test_hra_preprocessor(self):
|
||||
"""HRA: preprocessor coverage."""
|
||||
import natcap.invest.habitat_risk_assessment.hra_preprocessor
|
||||
|
|
|
@ -6,7 +6,6 @@ import os
|
|||
|
||||
import pandas
|
||||
import pygeoprocessing.testing
|
||||
from pygeoprocessing.testing import scm
|
||||
|
||||
SAMPLE_DATA = os.path.join(
|
||||
os.path.dirname(__file__), '..', 'data', 'invest-test-data',
|
||||
|
@ -46,8 +45,6 @@ class ScenarioProximityTests(unittest.TestCase):
|
|||
}
|
||||
return args
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA)
|
||||
@scm.skip_if_data_missing(REGRESSION_DATA)
|
||||
def test_scenario_gen_regression(self):
|
||||
"""Scenario Gen Proximity: regression testing all functionality."""
|
||||
from natcap.invest import scenario_gen_proximity
|
||||
|
@ -76,8 +73,6 @@ class ScenarioProximityTests(unittest.TestCase):
|
|||
REGRESSION_DATA, 'nearest_to_edge_regression.csv'))
|
||||
pandas.testing.assert_frame_equal(base_table, expected_table)
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA)
|
||||
@scm.skip_if_data_missing(REGRESSION_DATA)
|
||||
def test_scenario_gen_farthest(self):
|
||||
"""Scenario Gen Proximity: testing small far functionality."""
|
||||
from natcap.invest import scenario_gen_proximity
|
||||
|
|
|
@ -7,7 +7,6 @@ import csv
|
|||
import re
|
||||
|
||||
import pygeoprocessing.testing
|
||||
from pygeoprocessing.testing import scm
|
||||
from pygeoprocessing.testing import sampledata
|
||||
import numpy
|
||||
import numpy.testing
|
||||
|
@ -209,8 +208,6 @@ class WaveEnergyUnitTests(unittest.TestCase):
|
|||
for res, exp_res in zip(result_id, expected_result_id):
|
||||
self.assertEqual(res, exp_res)
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA)
|
||||
@scm.skip_if_data_missing(REGRESSION_DATA)
|
||||
def test_clip_datasource_layer_polygons(self):
|
||||
"""WaveEnergy: testing clipping polygons from polygons."""
|
||||
from natcap.invest.wave_energy import wave_energy
|
||||
|
@ -349,7 +346,6 @@ class WaveEnergyUnitTests(unittest.TestCase):
|
|||
|
||||
result_file.close()
|
||||
|
||||
@scm.skip_if_data_missing(REGRESSION_DATA)
|
||||
def test_load_binary_wave_data(self):
|
||||
"""WaveEnergy: testing 'load_binary_wave_data' function."""
|
||||
from natcap.invest.wave_energy import wave_energy
|
||||
|
@ -404,8 +400,6 @@ class WaveEnergyRegressionTests(unittest.TestCase):
|
|||
}
|
||||
return args
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA)
|
||||
@scm.skip_if_data_missing(REGRESSION_DATA)
|
||||
def test_valuation(self):
|
||||
"""WaveEnergy: testing valuation component."""
|
||||
from natcap.invest.wave_energy import wave_energy
|
||||
|
@ -448,8 +442,6 @@ class WaveEnergyRegressionTests(unittest.TestCase):
|
|||
os.path.join(args['workspace_dir'], 'output', table_path),
|
||||
os.path.join(REGRESSION_DATA, 'valuation', table_path))
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA)
|
||||
@scm.skip_if_data_missing(REGRESSION_DATA)
|
||||
def test_aoi_no_val(self):
|
||||
"""WaveEnergy: testing Biophysical component w AOI but w/o valuation."""
|
||||
from natcap.invest.wave_energy import wave_energy
|
||||
|
@ -476,8 +468,6 @@ class WaveEnergyRegressionTests(unittest.TestCase):
|
|||
os.path.join(REGRESSION_DATA, 'aoi', table_path),
|
||||
1e-6)
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA)
|
||||
@scm.skip_if_data_missing(REGRESSION_DATA)
|
||||
def test_no_aoi_or_val(self):
|
||||
"""WaveEnergy: testing Biophysical component w/o AOI or valuation."""
|
||||
from natcap.invest.wave_energy import wave_energy
|
||||
|
@ -503,8 +493,6 @@ class WaveEnergyRegressionTests(unittest.TestCase):
|
|||
os.path.join(REGRESSION_DATA, 'noaoi', table_path),
|
||||
1e-6)
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA)
|
||||
@scm.skip_if_data_missing(REGRESSION_DATA)
|
||||
def test_valuation_suffix(self):
|
||||
"""WaveEnergy: testing suffix through Valuation."""
|
||||
from natcap.invest.wave_energy import wave_energy
|
||||
|
|
|
@ -6,7 +6,6 @@ import os
|
|||
import csv
|
||||
|
||||
import pygeoprocessing.testing
|
||||
from pygeoprocessing.testing import scm
|
||||
from pygeoprocessing.testing import sampledata
|
||||
import numpy
|
||||
import numpy.testing
|
||||
|
@ -225,7 +224,6 @@ class WindEnergyUnitTests(unittest.TestCase):
|
|||
|
||||
self.assertDictEqual(expected_result, result)
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA)
|
||||
def test_read_csv_wind_parameters(self):
|
||||
"""WindEnergy: testing 'read_csv_wind_parameter' function."""
|
||||
from natcap.invest.wind_energy import wind_energy
|
||||
|
@ -539,8 +537,6 @@ class WindEnergyRegressionTests(unittest.TestCase):
|
|||
|
||||
return args
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA)
|
||||
@scm.skip_if_data_missing(REGRESSION_DATA)
|
||||
def test_no_aoi(self):
|
||||
"""WindEnergy: testing base case w/o AOI, distances, or valuation."""
|
||||
from natcap.invest.wind_energy import wind_energy
|
||||
|
@ -566,8 +562,6 @@ class WindEnergyRegressionTests(unittest.TestCase):
|
|||
os.path.join(args['workspace_dir'], 'output', vector_path),
|
||||
os.path.join(REGRESSION_DATA, 'noaoi', vector_path), 1E-6)
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA)
|
||||
@scm.skip_if_data_missing(REGRESSION_DATA)
|
||||
def test_no_land_polygon(self):
|
||||
"""WindEnergy: testing case w/ AOI but w/o land poly or distances."""
|
||||
from natcap.invest.wind_energy import wind_energy
|
||||
|
@ -595,8 +589,6 @@ class WindEnergyRegressionTests(unittest.TestCase):
|
|||
os.path.join(args['workspace_dir'], 'output', vector_path),
|
||||
os.path.join(REGRESSION_DATA, 'nolandpoly', vector_path), 1E-6)
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA)
|
||||
@scm.skip_if_data_missing(REGRESSION_DATA)
|
||||
def test_no_distances(self):
|
||||
"""WindEnergy: testing case w/ AOI and land poly, but w/o distances."""
|
||||
from natcap.invest.wind_energy import wind_energy
|
||||
|
@ -626,8 +618,6 @@ class WindEnergyRegressionTests(unittest.TestCase):
|
|||
os.path.join(args['workspace_dir'], 'output', vector_path),
|
||||
os.path.join(REGRESSION_DATA, 'nodistances', vector_path), 1E-6)
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA)
|
||||
@scm.skip_if_data_missing(REGRESSION_DATA)
|
||||
def test_val_gridpts_windprice(self):
|
||||
"""WindEnergy: testing Valuation w/ grid pts and wind price."""
|
||||
from natcap.invest.wind_energy import wind_energy
|
||||
|
@ -669,8 +659,6 @@ class WindEnergyRegressionTests(unittest.TestCase):
|
|||
os.path.join(args['workspace_dir'], 'output', vector_path),
|
||||
os.path.join(REGRESSION_DATA, 'pricevalgrid', vector_path), 1E-6)
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA)
|
||||
@scm.skip_if_data_missing(REGRESSION_DATA)
|
||||
def test_val_land_grid_points(self):
|
||||
"""WindEnergy: testing Valuation w/ grid/land pts and wind price."""
|
||||
from natcap.invest.wind_energy import wind_energy
|
||||
|
@ -717,8 +705,6 @@ class WindEnergyRegressionTests(unittest.TestCase):
|
|||
os.path.join(REGRESSION_DATA, 'pricevalgridland', vector_path),
|
||||
1E-6)
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA)
|
||||
@scm.skip_if_data_missing(REGRESSION_DATA)
|
||||
def test_grid_points_no_aoi(self):
|
||||
"""WindEnergy: testing ValueError raised w/ grid points but w/o AOI."""
|
||||
from natcap.invest.wind_energy import wind_energy
|
||||
|
@ -740,8 +726,6 @@ class WindEnergyRegressionTests(unittest.TestCase):
|
|||
|
||||
self.assertRaises(ValueError, wind_energy.execute, args)
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA)
|
||||
@scm.skip_if_data_missing(REGRESSION_DATA)
|
||||
def test_field_error_missing_bio_param(self):
|
||||
"""WindEnergy: testing that ValueError raised when missing bio param."""
|
||||
from natcap.invest.wind_energy import wind_energy
|
||||
|
@ -784,8 +768,6 @@ class WindEnergyRegressionTests(unittest.TestCase):
|
|||
|
||||
self.assertRaises(ValueError, wind_energy.execute, args)
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA)
|
||||
@scm.skip_if_data_missing(REGRESSION_DATA)
|
||||
def test_missing_valuation_params(self):
|
||||
"""WindEnergy: testing that ValueError is thrown when val params miss."""
|
||||
from natcap.invest.wind_energy import wind_energy
|
||||
|
@ -836,8 +818,6 @@ class WindEnergyRegressionTests(unittest.TestCase):
|
|||
|
||||
self.assertRaises(ValueError, wind_energy.execute, args)
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA)
|
||||
@scm.skip_if_data_missing(REGRESSION_DATA)
|
||||
def test_time_period_exceptoin(self):
|
||||
"""WindEnergy: raise ValueError if 'time' and 'wind_sched' differ."""
|
||||
from natcap.invest.wind_energy import wind_energy
|
||||
|
@ -895,8 +875,6 @@ class WindEnergyRegressionTests(unittest.TestCase):
|
|||
|
||||
self.assertRaises(ValueError, wind_energy.execute, args)
|
||||
|
||||
@scm.skip_if_data_missing(SAMPLE_DATA)
|
||||
@scm.skip_if_data_missing(REGRESSION_DATA)
|
||||
def test_remove_datasources(self):
|
||||
"""WindEnergy: testing datasources which already exist are removed."""
|
||||
from natcap.invest.wind_energy import wind_energy
|
||||
|
|
Loading…
Reference in New Issue