Closed goxberry closed 1 year ago
Base: 84.48% // Head: 84.55% // Increases project coverage by +0.07%
:tada:
Coverage data is based on head (
183d815
) compared to base (53f1adb
). Patch coverage: 71.42% of modified lines in pull request are covered.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
I decided it might be better to ensure the example YAML configuration file in the documentation is tested, so I replaced sphinx_panels
/sphinx-panels
in that example with sphinx_design
/sphinx-design
, made it a YAML file, and used a literalinclude
directive to include it in the documentation.
@chrisjsewell As far as I can tell, the only CI failure is the codecov
patch coverage test. Otherwise, it should be ready for review.
I think this can be closed then thanks
Attempting to run
rst2myst
using a YAML configuration file similar to that in the project's documentationon a reStructuredText file with contents
will yield
in the output.
Similarly, omitting the
conversions:
key (and its children) from the YAML config file above, but otherwise repeating therst2myst
same command will yieldin the output.
This pull request adds a test for these failures that uses the
--dry-run
option, and adds changes to resolve the failures.The pull request probably needs some work, but the basic idea is that Click will convert the correctly parsed YAML input for the
--extensions
and--conversions
arguments into strings passed to thevalue
parameters of thesplit_extensions
andread_conversions
methods inrst_to_myst.cli
. Using the example above, the value of thevalue
parameter passed torst_to_myst.cli.split_extensions
is"['sphinx_design']"
, instead of a list, and the value of thevalue
parameter passed torst_to_myst.cli.read_conversions
is"{'sphinx_design.dropdown.DropdownDirective': 'parse_all'}"
instead of a dictionary (or other mapping type).The fixes proposed in the pull request are to:
rst_to_myst.cli.split_extensions
, test if thevalue
parameter contains[
or]
characters. If it does, attempt to use Python's standard libraryast
module to convert the string to a list.rst_to_myst.cli.read_conversions
, test if thevalue
parameter contains{
or}
characters. If it does, attempt to use Python's standard libraryast
module to convert the string to a dictionary.The latter fix is probably not as robust as it could be, in that, e.g.,
"{'sphinx_design.dropdown.DropdownDirective': 'parse_all'}"
is probably a legal POSIX filename -- if I remember correctly, the main restriction for POSIX filenames is that identifiers cannot contain null characters. For now, the fix assumes a user does not intend to pass a path to a conversions YAML configuration file containing braces because it seemed like a good stopping point to solicit maintainer feedback.