Files
galaxy/test/functional/tools/composite_shapefile.xml
mvdbeek fd7de9f15b Drop fiona requirement from shapefile_composite test tool
The tool only used fiona to print the shapefile schema, which pulled a
329 MB conda environment (Python 3.7 + GDAL) into the test's 60 s window
and timed out under pytest-xdist. Read the field descriptors from the
.dbf header with the standard library instead. The composite datatype
checks on the extra files are unchanged.
2026-10-19 09:27:40 +02:00

54 lines
2.4 KiB
XML

<tool id="shapefile_composite" name="composite shapefile tool" version="1.0.0">
<command><![CDATA[
mkdir '$output_shapefile.extra_files_path' &&
python '$dbf_fields' '$input.extra_files_path/shapefile.dbf' > '$output' &&
cp '$input.extra_files_path'/* '$output_shapefile.extra_files_path'
]]>
</command>
<configfiles>
<configfile name="dbf_fields">import sys
with open(sys.argv[1], "rb") as fh:
fh.read(32)
while True:
descriptor = fh.read(32)
if not descriptor or descriptor[0] == 0x0D:
break
name = descriptor[:11].split(b"\x00")[0].decode()
print(name, chr(descriptor[11]), descriptor[16])
</configfile>
</configfiles>
<inputs>
<param name="input" type="data" format="shp" label="Shapefile" help="Used in GIS applications"/>
</inputs>
<outputs>
<data name="output" format="txt" label="${tool.name} on ${on_string}: Shapefile test" />
<data name="output_shapefile" format="shp" label="${tool.name} on ${on_string}: Shapefile test - shp" />
</outputs>
<tests>
<test>
<param name="input" value="" ftype="shp" >
<composite_data value="shapefile/shapefile.shp"/>
<composite_data value="shapefile/shapefile.shx"/>
<composite_data value="shapefile/shapefile.dbf"/>
<composite_data value="shapefile/shapefile.prj"/>
</param>
<output name="output">
<assert_contents>
<has_n_lines n="11" />
<has_line line="FIPS C 2" />
<has_line line="ISO2 C 2" />
<has_line line="ISO3 C 3" />
<has_line line="UN N 3" />
</assert_contents>
</output>
<output name="output_shapefile" file="shapefile/output.html">
<extra_files type="file" name="shapefile.shp" value="shapefile/shapefile.shp" md5="ae4648a8a6be706e910e46607f261317" />
<extra_files type="file" name="shapefile.shx" value="shapefile/shapefile.shx" md5="6321ef787b7826afe06e9cf3eb20e656" />
<extra_files type="file" name="shapefile.dbf" value="shapefile/shapefile.dbf" md5="d65d87e1570510af8a81d7d174ea361a" />
<extra_files type="file" name="shapefile.prj" value="shapefile/shapefile.prj" lines_diff="2" />
</output>
</test>
</tests>
</tool>