-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(settings): Add support to tables in toml settings #362
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks.
Can you add a test for custom types?
In this way we will make sure that this feature will always work and it will not be broken by future work.
But if you don't have time for a test, that is ok.
We can merge it as it is.
Thanks again!
Yes, I think I can do it tomorrow. Thanks! |
4bc9135
to
692e364
Compare
src/towncrier/test/test_settings.py
Outdated
@@ -30,6 +30,61 @@ def test_base(self): | |||
self.assertEqual(config["filename"], "NEWS.rst") | |||
self.assertEqual(config["underlines"], ["=", "-", "~"]) | |||
|
|||
def test_custom_types(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we these as 2 tests with separate docstring.
I am not sure that is the targeted difference between readme_format and alternative_format.
For the docstring, my suggetion is something like this
Custom fragment categories can be defined inside the toml config file using implicit file extension.
The file extension is the same as directory name.
Custom fragment categories can be defined inside the toml config file using custom file extension.
The file extension is define by the section name.
Does these docstrings make sense?
Is this what it is tested?
You can refactor the shared code in a helper function...but I think that it helps to have 2 separate test functions with 2 docstrings as they are covering 2 separate uses cases.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
and since this is a new feature, can you also update the configuration ? Thanks! |
Codecov Report
@@ Coverage Diff @@
## master #362 +/- ##
==========================================
+ Coverage 96.81% 96.86% +0.05%
==========================================
Files 20 20
Lines 1194 1214 +20
Branches 108 110 +2
==========================================
+ Hits 1156 1176 +20
Misses 20 20
Partials 18 18
Continue to review full report at Codecov.
|
* Iterate through values if types is a mapping instead of an array. Resolves: twisted/twisted#361 Signed-off-by: danieljmv01 <danieljmv01@gmail.com>
Initially I didn't know that I was passing the configuration in an unexpected way, and I considered this a bug. I tried to just fix it, without adding new features.
I am not sure about what do you refer. The configuration docs? Thanks! |
Is this PR still valid or can be closed as invalid? My understanding is that you found a way to use the existing towncrier functionality to implement your requirements. I guess that we ended up with this PR since the existing documentation was not clear enough. So maybe the documentation can be improved. |
Hi @adiroiban I would like to update the PR, I want to update the docs regarding this topic, but the docs sources appears to exists in a branch that is not master. |
@danieljmv01 . I have created #367 to solve the docs issue. I prefer to have the code and docs in the same repo. I agree that things are very confusing with the current setup. So, if you have time, I am more than happy to review and approve a PR which moves the doc files into the main branch. |
Perfect, I will do it today after work. |
@danieljmv01 can we close this PR? is there any value in having it merged? Thanks |
@adiroiban as is right now: no I don't see any value added. I wanted to keep changes as minimal as possible, and ended not adding value. What I would like is to give users a simpler, clearer and more intuitive and clear way to configure custom fragment types. I want to support this: code-block-1:
Since the title of each table would describe the custom fragment type (see code-block-1) the field In the alternative (existing) way to configure custom types you have to include the I would rather wait until #368 is merged to rebase and update this, so I can document this in this PR. After rebasing this branch, I will update the code to support omitting the |
Ok.No hurry from my side. |
@adiroiban I pushed to another branch since this is not a bug. I have created #370, I will close this one. |
Correct loop so that it iterates over the values and not the keys of the custom fragment types if provided.Resolves #361Resolves: twisted/#361