Remove lines of code unreached in tests.

Instead of catching and logging processing exceptions, we just
let the exception rise, which accomplishes the same thing.
This commit is contained in:
Sean Gillies 2015-05-26 22:36:07 -06:00
parent 20bd613905
commit 4ee35ebb15
2 changed files with 8 additions and 11 deletions

View File

@ -18,11 +18,9 @@ from rasterio.rio.cli import (
def get_bands(inputs, d, i=None):
"""Get a rasterio.Band object from calc's inputs"""
path = inputs[d] if d in dict(inputs) else inputs[int(d)-1][1]
if i:
return rasterio.band(rasterio.open(path), i)
else:
src = rasterio.open(path)
return [rasterio.band(src, i) for i in src.indexes]
src = rasterio.open(path)
return (rasterio.band(src, i) if i else
[rasterio.band(src, i) for i in src.indexes])
def read_array(ix, subix=None, dtype=None):
@ -141,8 +139,8 @@ def calc(ctx, command, files, output, name, dtype, masked):
click.echo(' ' + ' ' * err.offset + "^")
click.echo(err)
raise click.Abort()
except Exception as err:
t, v, tb = sys.exc_info()
for line in traceback.format_exception_only(t, v):
click.echo(line, nl=False)
raise click.Abort()
#except Exception as err:
# t, v, tb = sys.exc_info()
# for line in traceback.format_exception_only(t, v):
# click.echo(line, nl=False)
# raise click.Abort()

View File

@ -129,7 +129,6 @@ def test_fillnodata(tmpdir):
outfile],
catch_exceptions=False)
assert result.exit_code == 0
# import subprocess; subprocess.call(['open', outfile])
with rasterio.open(outfile) as src:
assert src.count == 3
assert src.meta['dtype'] == 'uint8'