lyrics: add rest_directory configuration option#6745
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6745 +/- ##
==========================================
+ Coverage 74.60% 74.86% +0.26%
==========================================
Files 163 163
Lines 20830 20831 +1
Branches 3283 3283
==========================================
+ Hits 15541 15596 +55
+ Misses 4538 4480 -58
- Partials 751 755 +4
🚀 New features to boost your workflow:
|
bdd7a46 to
6ece99d
Compare
6ece99d to
478ac8c
Compare
|
Hi @snejus, |
snejus
left a comment
There was a problem hiding this comment.
I think these tests are slightly too extensive. Your tests do something similar to TestRestFiles except that you override the configuration and use self.run_command to run lyrics command.
| pytest.param([]), | ||
| ], | ||
| ) | ||
| def test_bad_config(self, lyrics_plugin, bad_config): |
There was a problem hiding this comment.
There's no need to test confuse internals :)
| config_file = tmp_path / "config.yaml" | ||
| with config_file.open("w") as f: | ||
| f.write(f"lyrics:\n rest_directory: {rest_directory}") | ||
| self.config.set_file(config_file) | ||
| self.config.read(False, False) |
There was a problem hiding this comment.
You should use self.config to adjust configuration.
| cmd = lyrics_plugin.commands()[0] | ||
| cmd_args = [] if arg_path is None else ["-r", arg_path] | ||
| opts, args = cmd.parser.parse_args(cmd_args) | ||
| cmd.func(lib, opts, args) | ||
|
|
||
| if output_path is None: | ||
| for item in tmp_path.rglob("*"): | ||
| assert item.name != "index.rst" | ||
| assert item.name != "conf.py" | ||
| else: | ||
| assert (output_path / "index.rst").exists() | ||
| assert (output_path / "conf.py").exists() |
There was a problem hiding this comment.
And use self.run_command to run commands!
Description
Fixes #2806
Adds a
rest_directoryconfiguration option to the lyrics plugin that specifies a directory for ReST output, equivalent to the-r, --write-restcommand line argumentDocumentation.
Changelog.
Tests.