mkdir -p tests/data
cp test_data/coutwildrnp.zip tests/data
cp test_data/coutwildrnp.tar tests/data
cp test_data/coutwildrnp.json tests/data
cp -r tests /tmp/

pushd /tmp
py.test -s -rxs -v -k "not test_fio_ls_multi_layer" tests
popd


# the test_fio_ls_multi_layer seems to be a bad test and not a real failure.
# def test_fio_ls_multi_layer():
#
#     infile = 'tests/data/coutwildrnp.shp'
#     outdir = tempfile.mkdtemp()
#     try:
#
#         # Copy test shapefile into new directory
#         # Shapefile driver treats a directory of shapefiles as a single
#         # multi-layer datasource
#         layer_names = ['l1', 'l2']
#         for layer in layer_names:
#             with fiona.open(infile) as src, \
#                     fiona.open(outdir, 'w', layer=layer, **src.meta) as dst:
#                 for feat in src:
#                     dst.write(feat)
#
#         # Run CLI test
#         result = CliRunner().invoke(main_group, [
#             'ls', outdir])
#         assert result.exit_code == 0
# >           assert json.loads(result.output) == layer_names
# E           AssertionError: assert ['l2', 'l1'] == ['l1', 'l2']
# E             At index 0 diff: u'l2' != 'l1'
# E             Full diff:
# E             - [u'l2', u'l1']
# E             + ['l1', 'l2']
