Closed davidorme closed 2 months ago
@jacobcook1995 Apparently something is different in 3.11!
Oh and also the test failures for python 3.11
look really strange? Like I ran them locally with python 3.11
and everything passed, but on the GitHub runners it seems like literally every test failed
but on the GitHub runners it seems like literally every test failed
And all in the same way across platforms: ERROR test/test_summary.py::test_core[valid core] - TypeError: expected str, bytes or os.PathLike object, not _GeneratorContextManager
The issue turned out to be with the importlib.resources.paths
method (which is deprecated) and on exactly what gets returned by importlib.resources.files().joinpath()
: Traversable
not Path
, and although Path
is compatible, the attributes blah blah blah. It is not an obvious interface.
This PR closes #112
Off topic: the command line tools provided the
safedata_zenodo show_resources
andsafedata_metadata show_resources
subcommands, but nothing similar forsafedata_validate
. This PR removes the subcommands and implements the--show-resources
/-s
switch across all three commands. This prints the resources to screen and exits.The XML system needed more work than I thought. There is a bunch of hardcoded stuff in the XML template that was SAFE Project specific, as well as the stuff that is dataset specific. So:
[xml]
section in theResources
configuration.generate_inspire_xml
completely - rather than using a huge pile ofXPath
expressions to find and insert the data, this now usesjinja2
to populate the template much more clearly and easily.