Skip to content

Commit

Permalink
Automated: Rename all python tests to test_*
Browse files Browse the repository at this point in the history
Pytest learns what tests are by what it's called.
This change was generated by looking at `gdaltest_list` in autotest/ modules,
and renaming all mentioned tests if they weren't already called `test_*`
  • Loading branch information
craigds committed Dec 10, 2018
1 parent 1cdd430 commit b195f51
Show file tree
Hide file tree
Showing 335 changed files with 9,495 additions and 9,495 deletions.
28 changes: 14 additions & 14 deletions autotest/alg/applyverticalshiftgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
# Rather dummy test: grid = DEM


def applyverticalshiftgrid_1():
def test_applyverticalshiftgrid_1():

src_ds = gdal.Open('../gcore/data/byte.tif')
src_ds = gdal.Translate('', src_ds, format='MEM',
Expand Down Expand Up @@ -108,7 +108,7 @@ def applyverticalshiftgrid_1():
# Error cases


def applyverticalshiftgrid_2():
def test_applyverticalshiftgrid_2():

sr = osr.SpatialReference()
sr.SetFromUserInput("WGS84")
Expand Down Expand Up @@ -209,7 +209,7 @@ def applyverticalshiftgrid_2():
# Test with grid and src not in same projection


def applyverticalshiftgrid_3():
def test_applyverticalshiftgrid_3():

src_ds = gdal.Open('../gcore/data/byte.tif')
grid_ds = gdal.Warp('', src_ds, format='MEM', dstSRS='EPSG:4326',
Expand Down Expand Up @@ -260,7 +260,7 @@ def applyverticalshiftgrid_3():
# Test nodata


def applyverticalshiftgrid_4():
def test_applyverticalshiftgrid_4():

sr = osr.SpatialReference()
sr.SetFromUserInput("WGS84")
Expand Down Expand Up @@ -346,7 +346,7 @@ def applyverticalshiftgrid_4():
# Test scaling parameters


def applyverticalshiftgrid_5():
def test_applyverticalshiftgrid_5():

src_ds = gdal.Open('../gcore/data/byte.tif')
grid_ds = gdal.Translate('', src_ds, format='MEM')
Expand Down Expand Up @@ -380,7 +380,7 @@ def applyverticalshiftgrid_5():
# Simulate EGM grids


def applyverticalshiftgrid_6():
def test_applyverticalshiftgrid_6():

grid_ds = gdal.GetDriverByName('GTX').Create(
'/vsimem/applyverticalshiftgrid_6.gtx', 1440, 721, 1, gdal.GDT_Float32)
Expand All @@ -404,7 +404,7 @@ def applyverticalshiftgrid_6():
# Simulate USA geoid grids with long origin > 180


def applyverticalshiftgrid_7():
def test_applyverticalshiftgrid_7():

grid_ds = gdal.GetDriverByName('GTX').Create(
'/vsimem/applyverticalshiftgrid_7.gtx', 700, 721, 1, gdal.GDT_Float32)
Expand All @@ -426,13 +426,13 @@ def applyverticalshiftgrid_7():


gdaltest_list = [
applyverticalshiftgrid_1,
applyverticalshiftgrid_2,
applyverticalshiftgrid_3,
applyverticalshiftgrid_4,
applyverticalshiftgrid_5,
applyverticalshiftgrid_6,
applyverticalshiftgrid_7
test_applyverticalshiftgrid_1,
test_applyverticalshiftgrid_2,
test_applyverticalshiftgrid_3,
test_applyverticalshiftgrid_4,
test_applyverticalshiftgrid_5,
test_applyverticalshiftgrid_6,
test_applyverticalshiftgrid_7
]

if __name__ == '__main__':
Expand Down
20 changes: 10 additions & 10 deletions autotest/alg/contour.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
# Test with -a and -i options


def contour_1():
def test_contour_1():

try:
os.remove('tmp/contour.shp')
Expand Down Expand Up @@ -132,7 +132,7 @@ def contour_1():
# Test with -fl option and -3d option


def contour_2():
def test_contour_2():

try:
os.remove('tmp/contour.shp')
Expand Down Expand Up @@ -201,7 +201,7 @@ def contour_2():
#


def contour_real_world_case():
def test_contour_real_world_case():

ogr_ds = ogr.GetDriverByName('Memory').CreateDataSource('')
ogr_lyr = ogr_ds.CreateLayer('contour', geom_type=ogr.wkbLineString)
Expand All @@ -225,7 +225,7 @@ def contour_real_world_case():

# Test with -p option (polygonize)

def contour_3():
def test_contour_3():

try:
os.remove('tmp/contour.shp')
Expand Down Expand Up @@ -303,7 +303,7 @@ def contour_3():
# Cleanup


def contour_cleanup():
def test_contour_cleanup():
ogr.GetDriverByName('ESRI Shapefile').DeleteDataSource('tmp/contour.shp')
try:
os.remove('tmp/gdal_contour.tif')
Expand All @@ -314,11 +314,11 @@ def contour_cleanup():


gdaltest_list = [
contour_1,
contour_2,
contour_real_world_case,
contour_3,
contour_cleanup
test_contour_1,
test_contour_2,
test_contour_real_world_case,
test_contour_3,
test_contour_cleanup
]


Expand Down
16 changes: 8 additions & 8 deletions autotest/alg/cutline.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@
###############################################################################


def cutline_1():
def test_cutline_1():

tst = gdaltest.GDALTest('VRT', 'cutline_noblend.vrt', 1, 11409)
return tst.testOpen()

###############################################################################


def cutline_2():
def test_cutline_2():

if not ogrtest.have_geos():
return 'skip'
Expand All @@ -59,7 +59,7 @@ def cutline_2():
###############################################################################


def cutline_3():
def test_cutline_3():

if not ogrtest.have_geos():
return 'skip'
Expand All @@ -70,7 +70,7 @@ def cutline_3():
###############################################################################


def cutline_4():
def test_cutline_4():

if not ogrtest.have_geos():
return 'skip'
Expand Down Expand Up @@ -124,10 +124,10 @@ def cutline_4():


gdaltest_list = [
cutline_1,
cutline_2,
cutline_3,
cutline_4
test_cutline_1,
test_cutline_2,
test_cutline_3,
test_cutline_4
]

if __name__ == '__main__':
Expand Down
4 changes: 2 additions & 2 deletions autotest/alg/dither.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
# Test


def dither_1():
def test_dither_1():

drv = gdal.GetDriverByName('GTiff')

Expand Down Expand Up @@ -100,7 +100,7 @@ def dither_1():


gdaltest_list = [
dither_1
test_dither_1
]


Expand Down
22 changes: 11 additions & 11 deletions autotest/alg/polygonize.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
# Test a fairly simple case, with nodata masking.


def polygonize_1(is_int_polygonize=True):
def test_polygonize_1(is_int_polygonize=True):

src_ds = gdal.Open('data/polygonize_in.grd')
src_band = src_ds.GetRasterBand(1)
Expand Down Expand Up @@ -87,14 +87,14 @@ def polygonize_1(is_int_polygonize=True):
return 'success' if tr else 'fail'


def polygonize_1_float():
return polygonize_1(is_int_polygonize=False)
def test_polygonize_1_float():
return test_polygonize_1(is_int_polygonize=False)

###############################################################################
# Test a simple case without masking.


def polygonize_2():
def test_polygonize_2():

src_ds = gdal.Open('data/polygonize_in.grd')
src_band = src_ds.GetRasterBand(1)
Expand Down Expand Up @@ -132,7 +132,7 @@ def polygonize_2():
# A more involved case with a complex looping.


def polygonize_3():
def test_polygonize_3():

src_ds = gdal.Open('data/polygonize_in_2.grd')
src_band = src_ds.GetRasterBand(1)
Expand Down Expand Up @@ -175,7 +175,7 @@ def polygonize_3():
# Test a simple case without masking but with 8-connectedness.


def polygonize_4():
def test_polygonize_4():

src_ds = gdal.Open('data/polygonize_in.grd')
src_band = src_ds.GetRasterBand(1)
Expand Down Expand Up @@ -211,11 +211,11 @@ def polygonize_4():


gdaltest_list = [
polygonize_1,
polygonize_1_float,
polygonize_2,
polygonize_3,
polygonize_4
test_polygonize_1,
test_polygonize_1_float,
test_polygonize_2,
test_polygonize_3,
test_polygonize_4
]

if __name__ == '__main__':
Expand Down
12 changes: 6 additions & 6 deletions autotest/alg/proximity.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
# Test a fairly default case.


def proximity_1():
def test_proximity_1():

drv = gdal.GetDriverByName('GTiff')
src_ds = gdal.Open('data/pat.tif')
Expand Down Expand Up @@ -70,7 +70,7 @@ def proximity_1():
# Try several options


def proximity_2():
def test_proximity_2():

drv = gdal.GetDriverByName('GTiff')
src_ds = gdal.Open('data/pat.tif')
Expand Down Expand Up @@ -105,7 +105,7 @@ def proximity_2():
# Try input nodata option


def proximity_3():
def test_proximity_3():

drv = gdal.GetDriverByName('GTiff')
src_ds = gdal.Open('data/pat.tif')
Expand Down Expand Up @@ -138,9 +138,9 @@ def proximity_3():


gdaltest_list = [
proximity_1,
proximity_2,
proximity_3
test_proximity_1,
test_proximity_2,
test_proximity_3
]

if __name__ == '__main__':
Expand Down
24 changes: 12 additions & 12 deletions autotest/alg/rasterize.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
# Simple polygon rasterization.


def rasterize_1():
def test_rasterize_1():

# Setup working spatial reference
sr_wkt = 'LOCAL_CS["arbitrary"]'
Expand Down Expand Up @@ -105,7 +105,7 @@ def rasterize_1():
# Test rasterization with ALL_TOUCHED.


def rasterize_2():
def test_rasterize_2():

# Setup working spatial reference
sr_wkt = 'LOCAL_CS["arbitrary"]'
Expand Down Expand Up @@ -151,7 +151,7 @@ def rasterize_2():
# Rasterization with BURN_VALUE_FROM.


def rasterize_3():
def test_rasterize_3():

# Setup working spatial reference
sr_wkt = 'LOCAL_CS["arbitrary"]'
Expand Down Expand Up @@ -207,7 +207,7 @@ def rasterize_3():
# Rasterization with ATTRIBUTE.


def rasterize_4():
def test_rasterize_4():

# Setup working spatial reference
sr_wkt = 'LOCAL_CS["arbitrary"]'
Expand Down Expand Up @@ -266,7 +266,7 @@ def rasterize_4():
# Rasterization with MERGE_ALG=ADD.


def rasterize_5():
def test_rasterize_5():

# Setup working spatial reference
sr_wkt = 'LOCAL_CS["arbitrary"]'
Expand Down Expand Up @@ -337,7 +337,7 @@ def rasterize_5():
###############################################################################
# Test bug fix for #5580 (used to hang)

def rasterize_6():
def test_rasterize_6():

# Setup working spatial reference
sr_wkt = 'LOCAL_CS["arbitrary"]'
Expand All @@ -361,12 +361,12 @@ def rasterize_6():


gdaltest_list = [
rasterize_1,
rasterize_2,
rasterize_3,
rasterize_4,
rasterize_5,
rasterize_6
test_rasterize_1,
test_rasterize_2,
test_rasterize_3,
test_rasterize_4,
test_rasterize_5,
test_rasterize_6
]

if __name__ == '__main__':
Expand Down
Loading

0 comments on commit b195f51

Please sign in to comment.