-
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
Provide a --version option #341
Conversation
If I'm not mistaken, the failures looks like they are not directly related to my changes. I could hunt down two issues. The first one was about some space issues: @@ -116,6 +116,13 @@ class InvocationTests(TestCase):
os.makedirs("news")
out = check_output([sys.executable, "-m", "towncrier", "--help"])
self.assertIn(b"[OPTIONS] COMMAND [ARGS]...", out)
- self.assertIn(b"--help Show this message and exit.", out)
+ self.assertIn(b"--help Show this message and exit.", out) To my understanding, if I introduce just a simple option ( Shouldn't we write the above test in such a way that spaces donn't really matter? Isn't it possible to match against some regex like The other issue was in Hope someone with more knowledge than I could look into this. Thanks! 👍 |
I don't know. The tests were executed 7 days ago and they were green https://github.com/twisted/towncrier/runs/2288463008 I am manually triggering a re-run on the main trunk branch https://github.com/twisted/towncrier/runs/2341993285
Yes. One option is to use assertRegex |
It looks like the failures are from this branch as trunk is green https://github.com/twisted/towncrier/runs/2341993285 @tomschr are the test green when you execute them on your local dev system? Are the trunk tests also green on your local dev? Trunk is green on my local Ubuntu
I am checking your branch now... it fails and I am investigating the issue |
The issue is I don't know how click works but you can try diff --git a/src/towncrier/_shell.py b/src/towncrier/_shell.py
index 4023da3..bc91861 100644
--- a/src/towncrier/_shell.py
+++ b/src/towncrier/_shell.py
@@ -17,7 +17,7 @@ from ._version import __version__
@click.group(cls=DefaultGroup, default="build", default_if_no_args=True)
@click.version_option(__version__.public())
@click.pass_context
-def cli():
+def cli(*args, **kwargs):
pass
|
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 for the PR.
I think that it looks good.... but it needs some cleanup.
Do we need @click.pass_context
?
I have removed it and test_version
was still green.
Would be nice to use assertRegex
instead of assertIn
but I am also ok with your quick fix for assertIn
:)
Thanks!
Codecov Report
@@ Coverage Diff @@
## master #341 +/- ##
==========================================
+ Coverage 96.78% 96.79% +0.01%
==========================================
Files 20 20
Lines 1182 1187 +5
Branches 106 106
==========================================
+ Hits 1144 1149 +5
Misses 20 20
Partials 18 18
Continue to review full report at Codecov.
|
Hi @adiroiban, Should I squash the commits or are you doing it? 🙂 Thanks again! |
You can squash the commit and don't forget to add a news fragment inside This is why It can be
|
8924ee6
to
b5f7d3e
Compare
Seems this time I was successful. 😄 Adi, anything else I should add, correct etc.? |
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.
Look good. Only a few minor comments :) Thanks!
* Create and adapt tests for `--version` * Add newsfragment Co-authored-by: Adi Roiban <adiroiban@gmail.com>
170ff02
to
d5dae8d
Compare
Thanks to you both. |
I think this PR broke our CI at NumPy, because This is mainly to let you know that this breaks (maybe add a release note). I can fix it by using |
Thanks @seberg for the report. Much appreciated and it's an important side effect. I guess that in order to not break backward compatibility we can add But maybe we should should just go with towncrier subcommands and in this case we need to update the release note and inform about this backward incompatible change. |
The default subcommands are nice for backwards compatibility, but maybe when we add them the implicit usage should be deprecated and later removed. I'm not used to using default subcommands so definitely thanks for filling that gap in my thinking and reporting this @seberg. |
This PR fixes #339 and adds a
--version
option. This makes it possible to run the command like this: