mirror of
https://github.com/rasterio/rasterio.git
synced 2026-02-01 14:34:43 +00:00
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:
parent
20bd613905
commit
4ee35ebb15
@ -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()
|
||||
|
||||
@ -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'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user