-
Notifications
You must be signed in to change notification settings - Fork 122
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
Make consistent the expectation around non-existent fragments directory #557
Make consistent the expectation around non-existent fragments directory #557
Conversation
4bef7d6
to
a5bf1ac
Compare
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 very good. Many thanks.
Only minor comments.
self.assertEqual(1, result.exit_code, result.output) | ||
self.assertIn("Failed to list the news fragment files.\n", result.output) | ||
self.assertEqual(0, result.exit_code) | ||
self.assertIn("No significant changes.\n", result.output) |
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.
Thanks. It looks like this was a bug.
The test docstring states that it is expected to handle it as no changes, but in fact it was failing :)
By default, the processed news fragments are removed using ``git``, which will | ||
also remove the fragments directory if now empty. |
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.
By default, the processed news fragments are removed using ``git``, which will | |
also remove the fragments directory if now empty. | |
By default, the processed news fragments are removed using ``git rm``. |
I don't think that towncrier
(or git) explicitly removes the empty dir.
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.
I tested this expectation in one of my projects. For example, you can checkout /jaraco/skeleton, which currently has one fragment, and run towncrier build 0.0.0, and it will remove the newsfragmenta dir.
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.
Here's where I did just that yesterday:
@ work-on skeleton
skeleton main @ towncrier build --version 0.0.0
Loading template...
Finding news fragments...
Rendering news fragments...
Writing to newsfile...
Staging newsfile...
I want to remove the following files:
/Users/jaraco/code/jaraco/skeleton/newsfragments/+drop-py37.feature.rst
Is it okay if I remove those files? [Y/n]: y
Removing news fragments...
Done!
skeleton main @ cat NEWS.rst
0.0.0
=====
Features
--------
- Require Python 3.8 or later.
skeleton main @ towncrier build --version 0.0.1
Loading template...
Finding news fragments...
Failed to list the news fragment files.
FileNotFoundError: [Errno 2] No such file or directory: '/Users/jaraco/code/jaraco/skeleton/newsfragments'
skeleton main @ mkdir newsfragments
skeleton main @ towncrier build --version 0.0.1
Loading template...
Finding news fragments...
Rendering news fragments...
Writing to newsfile...
Staging newsfile...
No news fragments to remove. Skipping!
Done!
a5bf1ac
to
ed02443
Compare
…gments directory.
…ted like an empty directory. Closes twisted#538.
ed02443
to
c36652f
Compare
Thanks. Sorry for the extra trouble. I have merged it. |
@adiroiban you're gonna laugh, but I think we ran into this situation as well. I think we're gonna change our process for other reasons in a way that this isn't a problem. However, just in case, would you mind cutting a release with this in the next few days? Thanks a bunch!! |
Description
In the first commit, I update the documentation to reflect the current behavior, highlighting that a missing fragments directory is normal for a "create" operation and caused by the "build" operation.
In the second commit, I expand the documentation to include the case where "build" is invoked and the fragments directory is missing to be consistent with an empty directory or no directory at all. I also draft a likely way to achieve this behavior. Once tests pass, this approach closes #538.
Note that this change aligns the behavior with the currently prescribed expectation.
Checklist
src/towncrier/newsfragments/
. Describe yourchange and include important information. Your change will be included in the public release notes.
docs/tutorial.rst
is still up-to-date.docs/cli.rst
reflects those changes.docs/configuration.rst
reflects those changes.