-
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
Fix orphan fragments with numbers #564
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
.vs/ | ||
.vscode | ||
Justfile | ||
*egg-info/ | ||
_trial_temp*/ | ||
apidocs/ | ||
dist/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Orphan newsfragments containing numeric values are no longer accidentally associated to tickets. In previous versions the orphan marker was ignored and the newsfragment was associated to a ticket having the last numerical value from the filename. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Fragments with filenames like `fix-1.2.3.feature` are now associated with the ticket `fix-1.2.3`. | ||
In previous versions they were incorrectly associated to ticket `3`. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,14 @@ def _test_command(self, command): | |
f.write("Orphaned feature") | ||
with open("foo/newsfragments/+xxx.feature", "w") as f: | ||
f.write("Another orphaned feature") | ||
with open("foo/newsfragments/+123_orphaned.feature", "w") as f: | ||
f.write("An orphaned feature starting with a number") | ||
with open("foo/newsfragments/+12.3_orphaned.feature", "w") as f: | ||
f.write("An orphaned feature starting with a dotted number") | ||
with open("foo/newsfragments/+orphaned_123.feature", "w") as f: | ||
f.write("An orphaned feature ending with a number") | ||
with open("foo/newsfragments/+orphaned_12.3.feature", "w") as f: | ||
f.write("An orphaned feature ending with a dotted number") | ||
# Towncrier ignores files that don't have a dot | ||
with open("foo/newsfragments/README", "w") as f: | ||
f.write("Blah blah") | ||
|
@@ -52,7 +60,7 @@ def _test_command(self, command): | |
|
||
result = runner.invoke(command, ["--draft", "--date", "01-01-2001"]) | ||
|
||
self.assertEqual(0, result.exit_code) | ||
self.assertEqual(0, result.exit_code, result.output) | ||
self.assertEqual( | ||
result.output, | ||
dedent( | ||
|
@@ -70,9 +78,13 @@ def _test_command(self, command): | |
-------- | ||
|
||
- Baz levitation (baz) | ||
- Baz fix levitation (#2) | ||
- Baz fix levitation (fix-1.2) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not so sure about this one. But i'd argue, that is what was actually meant by:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that this need a better comment. I don't really understant what is the use case here. This is the bad part of bundling all kind of scenarios in a single test case.
since it has no orphan marker, I would consider it an error, and the file should be rejected. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As per my comment above, I think this snippet was parsed wrongly. But I cannot find anything in the docs about it the only reference is the comment (_builder.py):
And I do not think that in that case "3" was meant to be an issue number. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also I read the comment you cited as the "name of the newsfragment" being |
||
- Adds levitation (#123) | ||
- Extends levitation (#124) | ||
- An orphaned feature ending with a dotted number | ||
- An orphaned feature ending with a number | ||
- An orphaned feature starting with a dotted number | ||
- An orphaned feature starting with a number | ||
- Another orphaned feature | ||
- Orphaned feature | ||
|
||
|
@@ -405,6 +417,7 @@ def test_draft_no_date(self): | |
call(["git", "init"]) | ||
call(["git", "config", "user.name", "user"]) | ||
call(["git", "config", "user.email", "[email protected]"]) | ||
call(["git", "config", "commit.gpgSign", "false"]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We might need to refactor this code into an helper function that does the git init for us. I expect that this is needed in other tests. We can leave this as it is for now. There are numerous bad practices in the towncrier tests. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about this? |
||
call(["git", "add", "."]) | ||
call(["git", "commit", "-m", "Initial Commit"]) | ||
|
||
|
@@ -429,6 +442,7 @@ def test_no_confirmation(self): | |
call(["git", "init"]) | ||
call(["git", "config", "user.name", "user"]) | ||
call(["git", "config", "user.email", "[email protected]"]) | ||
call(["git", "config", "commit.gpgSign", "false"]) | ||
call(["git", "add", "."]) | ||
call(["git", "commit", "-m", "Initial Commit"]) | ||
|
||
|
@@ -458,6 +472,7 @@ def test_keep_fragments(self, runner): | |
call(["git", "init"]) | ||
call(["git", "config", "user.name", "user"]) | ||
call(["git", "config", "user.email", "[email protected]"]) | ||
call(["git", "config", "commit.gpgSign", "false"]) | ||
call(["git", "add", "."]) | ||
call(["git", "commit", "-m", "Initial Commit"]) | ||
|
||
|
@@ -491,6 +506,7 @@ def test_yes_keep_error(self, runner): | |
call(["git", "init"]) | ||
call(["git", "config", "user.name", "user"]) | ||
call(["git", "config", "user.email", "[email protected]"]) | ||
call(["git", "config", "commit.gpgSign", "false"]) | ||
call(["git", "add", "."]) | ||
call(["git", "commit", "-m", "Initial Commit"]) | ||
|
||
|
@@ -519,6 +535,7 @@ def test_confirmation_says_no(self): | |
call(["git", "init"]) | ||
call(["git", "config", "user.name", "user"]) | ||
call(["git", "config", "user.email", "[email protected]"]) | ||
call(["git", "config", "commit.gpgSign", "false"]) | ||
call(["git", "add", "."]) | ||
call(["git", "commit", "-m", "Initial Commit"]) | ||
|
||
|
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 guess we can have this. I have this rule in my global gitignore file
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.
good call.
Also this is a python project, so i'd expect that directory to exist eventually.